Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
c0977b2
1
Parent(s):
08f94fd
Update position filtering logic in Streamlit app to include 'QB' in position checks and streamline dataframe display handling for export functionality
Browse files- src/streamlit_app.py +4 -4
src/streamlit_app.py
CHANGED
@@ -243,7 +243,7 @@ if selected_tab == 'Stack Finder':
|
|
243 |
if pos_split2 == 'All Positions':
|
244 |
raw_baselines = raw_baselines
|
245 |
elif pos_split2 != 'All Positions':
|
246 |
-
raw_baselines = raw_baselines[raw_baselines['Position'].str.contains('|'.join(pos_var2))]
|
247 |
|
248 |
# Create a position dictionary mapping players to their eligible positions
|
249 |
pos_dict = dict(zip(raw_baselines.Player, raw_baselines.Position))
|
@@ -431,13 +431,13 @@ if selected_tab == 'Stack Finder':
|
|
431 |
cut_var += 1
|
432 |
except:
|
433 |
cut_var += 1
|
434 |
-
|
435 |
with stack_hold_container:
|
436 |
stack_hold_container = st.empty()
|
437 |
-
st.dataframe(
|
438 |
st.download_button(
|
439 |
label="Export Tables",
|
440 |
-
data=convert_df_to_csv(
|
441 |
file_name='NFL_Stack_Options_export.csv',
|
442 |
mime='text/csv',
|
443 |
)
|
|
|
243 |
if pos_split2 == 'All Positions':
|
244 |
raw_baselines = raw_baselines
|
245 |
elif pos_split2 != 'All Positions':
|
246 |
+
raw_baselines = raw_baselines[raw_baselines['Position'].str.contains('|'.join(pos_var2 + ['QB']))]
|
247 |
|
248 |
# Create a position dictionary mapping players to their eligible positions
|
249 |
pos_dict = dict(zip(raw_baselines.Player, raw_baselines.Position))
|
|
|
431 |
cut_var += 1
|
432 |
except:
|
433 |
cut_var += 1
|
434 |
+
st.session_state['display_frame'] = comb_DF
|
435 |
with stack_hold_container:
|
436 |
stack_hold_container = st.empty()
|
437 |
+
st.dataframe(st.session_state['display_frame'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), hide_index=True, use_container_width = True)
|
438 |
st.download_button(
|
439 |
label="Export Tables",
|
440 |
+
data=convert_df_to_csv(st.session_state['display_frame']),
|
441 |
file_name='NFL_Stack_Options_export.csv',
|
442 |
mime='text/csv',
|
443 |
)
|