Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
9402543
1
Parent(s):
c9d235d
Refactor CSV export functionality in app.py to conditionally display download buttons based on selected variable. Users can now export either marketshares or matchups data as CSV files, enhancing data export options.
Browse files
app.py
CHANGED
@@ -123,9 +123,17 @@ with col2:
|
|
123 |
display_parsed = display_parsed.set_index('Line')
|
124 |
st.dataframe(display_parsed.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), height=500, use_container_width = True)
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
display_parsed = display_parsed.set_index('Line')
|
124 |
st.dataframe(display_parsed.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), height=500, use_container_width = True)
|
125 |
|
126 |
+
if split_var1 == 'Line Marketshares':
|
127 |
+
st.download_button(
|
128 |
+
label="Export Marketshares (CSV)",
|
129 |
+
data=convert_df_to_csv(display_table),
|
130 |
+
file_name='Marketshares_export.csv',
|
131 |
+
mime='text/csv',
|
132 |
+
)
|
133 |
+
elif split_var1 == 'Slate Matchups':
|
134 |
+
st.download_button(
|
135 |
+
label="Export Matchups (CSV)",
|
136 |
+
data=convert_df_to_csv(display_table),
|
137 |
+
file_name='Matchups_export.csv',
|
138 |
+
mime='text/csv',
|
139 |
+
)
|