James McCool commited on
Commit
db1e9fe
·
1 Parent(s): 423ffa1

Enhance app.py by adding a team selection dropdown and multiselect for viewing specific teams in the Player ROO section, improving data filtering options for users.

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -160,9 +160,14 @@ with tab2:
160
  st.header("Player ROO")
161
  with st.expander("Info and Filters"):
162
  with st.container():
163
- slate_type_var2 = st.radio("Which slate type are you loading?", ('Showdown', 'Regular'), key='slate_type_var2')
164
  slate_var2 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'), key='slate_var2')
165
  pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'), key='pos_var2')
 
 
 
 
 
166
  if slate_type_var2 == 'Regular':
167
  player_roo_raw = roo_data.copy()
168
  if site_var == 'Draftkings':
@@ -197,6 +202,10 @@ with tab2:
197
  player_roo_raw['Site'] = 'Draftkings'
198
  elif site_var == 'Fanduel':
199
  player_roo_raw['Site'] = 'Fanduel'
 
 
 
 
200
  st.session_state['player_roo'] = player_roo_raw.drop(columns=['site', 'slate', 'version', 'timestamp'])
201
  if view_var == "Simple":
202
  st.session_state['player_roo'] = st.session_state['player_roo'][['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]
 
160
  st.header("Player ROO")
161
  with st.expander("Info and Filters"):
162
  with st.container():
163
+ slate_type_var2 = st.radio("Which slate type are you loading?", ('Regular', 'Showdown'), key='slate_type_var2')
164
  slate_var2 = st.radio("Which slate data are you loading?", ('Main', 'Secondary', 'Auxiliary'), key='slate_var2')
165
  pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'), key='pos_var2')
166
+ team_var2 = st.selectbox("Which team would you like to view?", ['All', 'Specific'], key='team_var2')
167
+ if team_var2 == 'Specific':
168
+ team_select2 = st.multiselect("Which team would you like to view?", roo_data['Team'].unique(), key='team_var2')
169
+ else:
170
+ team_select2 = None
171
  if slate_type_var2 == 'Regular':
172
  player_roo_raw = roo_data.copy()
173
  if site_var == 'Draftkings':
 
202
  player_roo_raw['Site'] = 'Draftkings'
203
  elif site_var == 'Fanduel':
204
  player_roo_raw['Site'] = 'Fanduel'
205
+
206
+ if team_select2:
207
+ player_roo_raw = player_roo_raw[player_roo_raw['Team'].isin(team_select2)]
208
+
209
  st.session_state['player_roo'] = player_roo_raw.drop(columns=['site', 'slate', 'version', 'timestamp'])
210
  if view_var == "Simple":
211
  st.session_state['player_roo'] = st.session_state['player_roo'][['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]