Spaces:
Running
Running
James McCool
commited on
Commit
·
1e7a422
1
Parent(s):
33e0f9f
Add download options for ROO data in Streamlit app, allowing users to export both Regular and Portfolio Manager formats. Streamlined data preparation for exports based on selected slate type, enhancing user experience and data accessibility.
Browse files- src/streamlit_app.py +30 -14
src/streamlit_app.py
CHANGED
@@ -215,15 +215,38 @@ with tab1:
|
|
215 |
site_var = st.radio("Select a Site", ["Draftkings", "FanDuel"])
|
216 |
with col3:
|
217 |
type_var = st.radio("Select a Type", ["Full Slate", "Showdown"])
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
with st.container():
|
220 |
-
|
221 |
-
display = hold_display[hold_display['Site'] == site_var]
|
222 |
-
display = display.drop_duplicates(subset=['Player'])
|
223 |
-
elif type_var == "Showdown":
|
224 |
-
display = sd_roo_data
|
225 |
-
display = display.drop_duplicates(subset=['Player'])
|
226 |
-
|
227 |
if view_var == "Simple":
|
228 |
if type_var == "Full Slate":
|
229 |
display = display[['Player', 'Cut_Odds', 'Salary', 'Median', '10x%', 'Own']]
|
@@ -236,13 +259,6 @@ with tab1:
|
|
236 |
display = display
|
237 |
display = display.set_index('Player')
|
238 |
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
239 |
-
|
240 |
-
st.download_button(
|
241 |
-
label="Export Projections",
|
242 |
-
data=convert_df_to_csv(display),
|
243 |
-
file_name='PGA_DFS_export.csv',
|
244 |
-
mime='text/csv',
|
245 |
-
)
|
246 |
|
247 |
with tab2:
|
248 |
with st.expander("Info and Filters"):
|
|
|
215 |
site_var = st.radio("Select a Site", ["Draftkings", "FanDuel"])
|
216 |
with col3:
|
217 |
type_var = st.radio("Select a Type", ["Full Slate", "Showdown"])
|
218 |
+
if type_var == "Full Slate":
|
219 |
+
display = hold_display[hold_display['Site'] == site_var]
|
220 |
+
display = display.drop_duplicates(subset=['Player'])
|
221 |
+
elif type_var == "Showdown":
|
222 |
+
display = sd_roo_data
|
223 |
+
display = display.drop_duplicates(subset=['Player'])
|
224 |
|
225 |
+
export_data = display.copy()
|
226 |
+
export_data_pm = display[['Player', 'Salary', 'Median', 'Own']]
|
227 |
+
export_data_pm['Position'] = 'G'
|
228 |
+
export_data_pm['Team'] = 'Golf'
|
229 |
+
export_data_pm['captain ownership'] = ''
|
230 |
+
export_data_pm = export_data_pm.rename(columns={'Own': 'ownership', 'Median': 'median', 'Player': 'player_names', 'Position': 'position', 'Team': 'team', 'Salary': 'salary'})
|
231 |
+
|
232 |
+
reg_dl_col, pm_dl_col, blank_col = st.columns([2, 2, 6])
|
233 |
+
with reg_dl_col:
|
234 |
+
st.download_button(
|
235 |
+
label="Export ROO (Regular)",
|
236 |
+
data=convert_df_to_csv(export_data),
|
237 |
+
file_name='NBA_ROO_export.csv',
|
238 |
+
mime='text/csv',
|
239 |
+
)
|
240 |
+
with pm_dl_col:
|
241 |
+
st.download_button(
|
242 |
+
label="Export ROO (Portfolio Manager)",
|
243 |
+
data=convert_df_to_csv(export_data_pm),
|
244 |
+
file_name='NBA_ROO_export.csv',
|
245 |
+
mime='text/csv',
|
246 |
+
)
|
247 |
+
|
248 |
with st.container():
|
249 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
if view_var == "Simple":
|
251 |
if type_var == "Full Slate":
|
252 |
display = display[['Player', 'Cut_Odds', 'Salary', 'Median', '10x%', 'Own']]
|
|
|
259 |
display = display
|
260 |
display = display.set_index('Player')
|
261 |
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
with tab2:
|
264 |
with st.expander("Info and Filters"):
|