streamlit_utils module¶
Contains various utility programs for Streamlit apps:
st_table_estimate
: to print a table of estimates with standard errorsst_download_numpy_as_csv
: button to download a Numpy array to a CSV filest_download_dataframe_as_csv
: button to download a Pandas dataframe to a CSV file.
st_download_dataframe_as_csv(df, file_name)
¶
button to download a DataFrame to a csv file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
a Pandas DataFrame |
required |
file_name |
str
|
the datafrme will be downloaded in file_name.csv |
required |
Returns:
Type | Description |
---|---|
None
|
nothing |
Source code in bs_python_utils/streamlit_utils.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
st_download_numpy_as_csv(arr, file_name)
¶
button to download an array to a csv file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr |
ndarray
|
a Numpy array |
required |
file_name |
str
|
the array will be downloaded in file_name.csv |
required |
Returns:
Type | Description |
---|---|
None
|
nothing |
Source code in bs_python_utils/streamlit_utils.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
st_table_estimates(coeff_names, estimates, stderrs, true_coeffs=None)
¶
returns a table of the estimates
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coeff_names |
list[str]
|
the names of the coefficients |
required |
estimates |
ndarray
|
the estimated values of the coefficients |
required |
stderrs |
ndarray
|
the standard errors of the estimates |
required |
true_coeffs |
ndarray | None
|
the true values of the coefficients, if available |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
the table |
Source code in bs_python_utils/streamlit_utils.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|