Spaces:
Running
Running
James McCool
commited on
Commit
·
b86749e
1
Parent(s):
5042463
Enhance user interface in app.py by updating team and position selection prompts for clarity, allowing users to select multiple teams and positions, thereby improving data filtering capabilities in player analysis.
Browse files
app.py
CHANGED
@@ -309,9 +309,14 @@ with tab2:
|
|
309 |
pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'), key='pos_var2')
|
310 |
team_var2 = st.selectbox("Which team would you like to view?", ['All', 'Specific'], key='team_var2')
|
311 |
if team_var2 == 'Specific':
|
312 |
-
team_select2 = st.multiselect("
|
313 |
else:
|
314 |
team_select2 = None
|
|
|
|
|
|
|
|
|
|
|
315 |
if slate_type_var2 == 'Regular':
|
316 |
if site_var == 'Draftkings':
|
317 |
|
@@ -351,6 +356,9 @@ with tab2:
|
|
351 |
|
352 |
if team_select2:
|
353 |
player_roo_raw = player_roo_raw[player_roo_raw['Team'].isin(team_select2)]
|
|
|
|
|
|
|
354 |
|
355 |
player_roo_disp = player_roo_raw
|
356 |
|
|
|
309 |
pos_var2 = st.radio("Which position group would you like to view?", ('All', 'Pitchers', 'Hitters'), key='pos_var2')
|
310 |
team_var2 = st.selectbox("Which team would you like to view?", ['All', 'Specific'], key='team_var2')
|
311 |
if team_var2 == 'Specific':
|
312 |
+
team_select2 = st.multiselect("Select your team(s)", roo_data['Team'].unique(), key='team_select2')
|
313 |
else:
|
314 |
team_select2 = None
|
315 |
+
pos_var2 = st.selectbox("Which position(s) would you like to view?", ['All', 'Specific'], key='pos_var2')
|
316 |
+
if pos_var2 == 'Specific':
|
317 |
+
pos_select2 = st.multiselect("Select your position(s)", roo_data['Position'].unique(), key='pos_select2')
|
318 |
+
else:
|
319 |
+
pos_select2 = None
|
320 |
if slate_type_var2 == 'Regular':
|
321 |
if site_var == 'Draftkings':
|
322 |
|
|
|
356 |
|
357 |
if team_select2:
|
358 |
player_roo_raw = player_roo_raw[player_roo_raw['Team'].isin(team_select2)]
|
359 |
+
if pos_select2:
|
360 |
+
position_mask = player_roo_raw['Position'].apply(lambda x: any(pos in x for pos in pos_select2))
|
361 |
+
player_roo_raw = player_roo_raw[position_mask]
|
362 |
|
363 |
player_roo_disp = player_roo_raw
|
364 |
|