James McCool commited on
Commit
4c1a5ef
·
1 Parent(s): 8015159

Add team filtering functionality to Player Stat and Prop Trend tables

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -118,10 +118,16 @@ prop_display, prop_trends, pick_frame, team_dict = pull_baselines()
118
  tab1, tab2, tab3 = st.tabs(["Player Stat Table", 'Prop Trend Table', 'Stat Specific Simulations'])
119
 
120
  with tab1:
121
- if st.button("Reset Data", key='reset1'):
122
- st.cache_data.clear()
123
- prop_display, prop_trends, pick_frame, team_dict = pull_baselines()
124
- prop_frame = prop_display
 
 
 
 
 
 
125
  st.dataframe(prop_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
126
 
127
  st.download_button(
@@ -133,10 +139,11 @@ with tab1:
133
  )
134
 
135
  with tab2:
136
- if st.button("Reset Data", key='reset3'):
137
- st.cache_data.clear()
138
- prop_display, prop_trends, pick_frame, team_dict = pull_baselines()
139
- with st.expander("Filter Options"):
 
140
  split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
141
  if split_var5 == 'Specific Teams':
142
  team_var5 = st.multiselect('Which teams would you like to include in the tables?', options = prop_trends['Team'].unique(), key='team_var5')
 
118
  tab1, tab2, tab3 = st.tabs(["Player Stat Table", 'Prop Trend Table', 'Stat Specific Simulations'])
119
 
120
  with tab1:
121
+ with st.expander("Info and Filters"):
122
+ if st.button("Reset Data", key='reset1'):
123
+ st.cache_data.clear()
124
+ prop_display, prop_trends, pick_frame, team_dict = pull_baselines()
125
+ team_var = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='team_var')
126
+ if team_var == 'Specific Teams':
127
+ team_var = st.multiselect('Which teams would you like to include in the tables?', options = prop_display['Team'].unique(), key='team_var')
128
+ elif team_var == 'All':
129
+ team_var = prop_display['Team'].unique()
130
+ prop_frame = prop_display[prop_display['Team'].isin(team_var)]
131
  st.dataframe(prop_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
132
 
133
  st.download_button(
 
139
  )
140
 
141
  with tab2:
142
+ with st.expander("Info and Filters"):
143
+ if st.button("Reset Data", key='reset3'):
144
+ st.cache_data.clear()
145
+ prop_display, prop_trends, pick_frame, team_dict = pull_baselines()
146
+
147
  split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
148
  if split_var5 == 'Specific Teams':
149
  team_var5 = st.multiselect('Which teams would you like to include in the tables?', options = prop_trends['Team'].unique(), key='team_var5')