James McCool commited on
Commit
1f1bb40
·
1 Parent(s): b7c1e62

Fix logic for team selection in Streamlit app

Browse files

- Updated the team selection for 'Full Slate Run' to use pitcher_stats instead of hitter_stats.
- Ensured that the filtering of pitcher_stats based on selected teams is correctly applied.

Files changed (1) hide show
  1. src/streamlit_app.py +2 -2
src/streamlit_app.py CHANGED
@@ -220,7 +220,7 @@ with col1:
220
  if sp_split1 == 'Specific Games':
221
  sp_var1 = st.multiselect('Which teams would you like to include in the Table?', options = pitcher_stats['Team'].unique(), key='sp_var1')
222
  elif sp_split1 == 'Full Slate Run':
223
- sp_var1 = hitter_stats.Team.values.tolist()
224
  elif stat_type_var1 == 'Hitters':
225
  site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='site_var1')
226
  if site_var1 == "Draftkings":
@@ -247,7 +247,7 @@ with col2:
247
  if stat_type_var1 == 'Pitchers':
248
  if stat_var1 == 'True AVG Splits':
249
  pitcher_stats = True_AVG_Splits_load()
250
- # pitcher_stats = pitcher_stats[pitcher_stats['Team'].isin(sp_var1)]
251
  #pitcher_stats = pitcher_stats.set_index('Player')
252
  st.dataframe(pitcher_stats.style.background_gradient(axis=0).background_gradient(cmap = 'RdYlGn_r').format(precision=3), use_container_width = True)
253
  if stat_var1 == 'HWSr Splits':
 
220
  if sp_split1 == 'Specific Games':
221
  sp_var1 = st.multiselect('Which teams would you like to include in the Table?', options = pitcher_stats['Team'].unique(), key='sp_var1')
222
  elif sp_split1 == 'Full Slate Run':
223
+ sp_var1 = pitcher_stats.Team.values.tolist()
224
  elif stat_type_var1 == 'Hitters':
225
  site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='site_var1')
226
  if site_var1 == "Draftkings":
 
247
  if stat_type_var1 == 'Pitchers':
248
  if stat_var1 == 'True AVG Splits':
249
  pitcher_stats = True_AVG_Splits_load()
250
+ pitcher_stats = pitcher_stats[pitcher_stats['Team'].isin(sp_var1)]
251
  #pitcher_stats = pitcher_stats.set_index('Player')
252
  st.dataframe(pitcher_stats.style.background_gradient(axis=0).background_gradient(cmap = 'RdYlGn_r').format(precision=3), use_container_width = True)
253
  if stat_var1 == 'HWSr Splits':