Spaces:
Running
Running
James McCool
commited on
Commit
·
80de24e
1
Parent(s):
6a2c013
Consolidate view type selector across tabs for consistent user experience
Browse filesMoved the "View Type" radio button outside of individual tabs to create a single, shared selector. This simplifies the UI and ensures consistent view type selection across Players, Line Combos, and Power Play tabs.
app.py
CHANGED
@@ -87,6 +87,8 @@ def convert_df_to_csv(df):
|
|
87 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
88 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
89 |
|
|
|
|
|
90 |
tab1, tab2, tab3 = st.tabs(["Player Range of Outcomes", "Line Combo Range of Outcomes", "Power Play Range of Outcomes"])
|
91 |
|
92 |
with tab1:
|
@@ -98,7 +100,6 @@ with tab1:
|
|
98 |
st.cache_data.clear()
|
99 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
100 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
101 |
-
view_var1 = st.radio("View Type", ("Simple", "Advanced"), key='view_var1')
|
102 |
site_var1 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var1')
|
103 |
main_var1 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var1')
|
104 |
split_var1 = st.radio("Would you like to view the whole slate or just specific games?", ('Full Slate Run', 'Specific Games'), key='split_var1')
|
@@ -147,7 +148,6 @@ with tab2:
|
|
147 |
st.cache_data.clear()
|
148 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
149 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
150 |
-
view_var2 = st.radio("View Type", ("Simple", "Advanced"), key='view_var2')
|
151 |
site_var2 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var2')
|
152 |
main_var2 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var2')
|
153 |
sal_var2 = st.slider("Is there a certain price range you want to view?", 5000, 40000, (5000, 40000), key='sal_var2')
|
@@ -160,10 +160,10 @@ with tab2:
|
|
160 |
final_line_combos = final_line_combos.drop_duplicates(subset=['Player'])
|
161 |
final_line_combos = final_line_combos.sort_values(by='Median', ascending=False)
|
162 |
|
163 |
-
if
|
164 |
display_proj_lines = final_line_combos[['Player', 'SK1', 'SK2', 'SK3', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '50+%', '2x%', '3x%', '4x%',
|
165 |
'Own']]
|
166 |
-
elif
|
167 |
display_proj_lines = final_line_combos[['SK1', 'SK2', 'SK3', 'Salary', 'Median', '3x%', 'Own']]
|
168 |
st.dataframe(display_proj_lines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), use_container_width = True, hide_index=True)
|
169 |
st.download_button(
|
@@ -182,7 +182,6 @@ with tab3:
|
|
182 |
st.cache_data.clear()
|
183 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
184 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
185 |
-
view_var3 = st.radio("View Type", ("Simple", "Advanced"), key='view_var3')
|
186 |
site_var3 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var3')
|
187 |
main_var3 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var3')
|
188 |
sal_var3 = st.slider("Is there a certain price range you want to view?", 5000, 40000, (5000, 40000), key='sal_var3')
|
@@ -195,10 +194,10 @@ with tab3:
|
|
195 |
final_pp_combos = final_pp_combos.drop_duplicates(subset=['Player'])
|
196 |
final_pp_combos = final_pp_combos.sort_values(by='Median', ascending=False)
|
197 |
|
198 |
-
if
|
199 |
display_proj_pp = final_pp_combos[['Player', 'SK1', 'SK2', 'SK3', 'SK4', 'SK5', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '75+%', '2x%', '3x%', '4x%',
|
200 |
'Own']]
|
201 |
-
elif
|
202 |
display_proj_pp = final_pp_combos[['SK1', 'SK2', 'SK3', 'SK4', 'SK5', 'Salary', 'Median', '3x%', 'Own']]
|
203 |
st.dataframe(display_proj_pp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True, hide_index=True)
|
204 |
st.download_button(
|
|
|
87 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
88 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
89 |
|
90 |
+
view_var1 = st.radio("View Type", ("Simple", "Advanced"), key='view_var1')
|
91 |
+
|
92 |
tab1, tab2, tab3 = st.tabs(["Player Range of Outcomes", "Line Combo Range of Outcomes", "Power Play Range of Outcomes"])
|
93 |
|
94 |
with tab1:
|
|
|
100 |
st.cache_data.clear()
|
101 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
102 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
|
|
103 |
site_var1 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var1')
|
104 |
main_var1 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var1')
|
105 |
split_var1 = st.radio("Would you like to view the whole slate or just specific games?", ('Full Slate Run', 'Specific Games'), key='split_var1')
|
|
|
148 |
st.cache_data.clear()
|
149 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
150 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
|
|
151 |
site_var2 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var2')
|
152 |
main_var2 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var2')
|
153 |
sal_var2 = st.slider("Is there a certain price range you want to view?", 5000, 40000, (5000, 40000), key='sal_var2')
|
|
|
160 |
final_line_combos = final_line_combos.drop_duplicates(subset=['Player'])
|
161 |
final_line_combos = final_line_combos.sort_values(by='Median', ascending=False)
|
162 |
|
163 |
+
if view_var1 == 'Advanced':
|
164 |
display_proj_lines = final_line_combos[['Player', 'SK1', 'SK2', 'SK3', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '50+%', '2x%', '3x%', '4x%',
|
165 |
'Own']]
|
166 |
+
elif view_var1 == 'Simple':
|
167 |
display_proj_lines = final_line_combos[['SK1', 'SK2', 'SK3', 'Salary', 'Median', '3x%', 'Own']]
|
168 |
st.dataframe(display_proj_lines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), use_container_width = True, hide_index=True)
|
169 |
st.download_button(
|
|
|
182 |
st.cache_data.clear()
|
183 |
player_frame, line_frame, pp_frame, timestamp = player_stat_table()
|
184 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
|
|
185 |
site_var3 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var3')
|
186 |
main_var3 = st.radio("Main slate or secondary slate?", ('Main Slate', 'Secondary Slate'), key='main_var3')
|
187 |
sal_var3 = st.slider("Is there a certain price range you want to view?", 5000, 40000, (5000, 40000), key='sal_var3')
|
|
|
194 |
final_pp_combos = final_pp_combos.drop_duplicates(subset=['Player'])
|
195 |
final_pp_combos = final_pp_combos.sort_values(by='Median', ascending=False)
|
196 |
|
197 |
+
if view_var1 == 'Advanced':
|
198 |
display_proj_pp = final_pp_combos[['Player', 'SK1', 'SK2', 'SK3', 'SK4', 'SK5', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '75+%', '2x%', '3x%', '4x%',
|
199 |
'Own']]
|
200 |
+
elif view_var1 == 'Simple':
|
201 |
display_proj_pp = final_pp_combos[['SK1', 'SK2', 'SK3', 'SK4', 'SK5', 'Salary', 'Median', '3x%', 'Own']]
|
202 |
st.dataframe(display_proj_pp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True, hide_index=True)
|
203 |
st.download_button(
|