James McCool commited on
Commit
cb833a2
·
1 Parent(s): db04e43

Refactor Handbuilder section in app.py to include a slate selection dropdown, allowing users to filter player data based on slate type. Updated team filtering logic to utilize the filtered handbuild_roo dataset for improved accuracy in player selection.

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -803,7 +803,17 @@ with tab3:
803
  )
804
 
805
  with tab4:
806
- st.header("Handbuilder")
 
 
 
 
 
 
 
 
 
 
807
 
808
  # --- POSITION LIMITS ---
809
  position_limits = {
@@ -829,7 +839,7 @@ with tab4:
829
 
830
  # --- TEAM FILTER UI ---
831
  with st.expander("Team Filters"):
832
- all_teams = sorted(dk_roo['Team'].unique())
833
  st.markdown("**Toggle teams to include:**")
834
  team_cols = st.columns(len(all_teams) // 2 + 1)
835
 
@@ -844,11 +854,11 @@ with tab4:
844
 
845
  # If no teams selected, show all teams
846
  if selected_teams:
847
- player_select_df = dk_roo[
848
- dk_roo['Team'].isin(selected_teams)
849
  ][['Player', 'Position', 'Team', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).sort_values(by='Order', ascending=True).copy()
850
  else:
851
- player_select_df = dk_roo[['Player', 'Position', 'Team', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).copy()
852
 
853
  with st.expander("Quick Fill Options"):
854
  auto_team_var = st.selectbox("Auto Fill Team", options=all_teams)
 
803
  )
804
 
805
  with tab4:
806
+ col1, col2 = st.columns(2)
807
+ with col1:
808
+ st.header("Handbuilder")
809
+ with col2:
810
+ slate_var3 = st.selectbox("Slate Selection", options=['Main', 'Secondary', 'Auxiliary'])
811
+ if slate_var3 == 'Main':
812
+ handbuild_roo = dk_roo[dk_roo['Slate'] == 'main_slate']
813
+ elif slate_var3 == 'Secondary':
814
+ handbuild_roo = dk_roo[dk_roo['Slate'] == 'secondary_slate']
815
+ elif slate_var3 == 'Auxiliary':
816
+ handbuild_roo = dk_roo[dk_roo['Slate'] == 'turbo_slate']
817
 
818
  # --- POSITION LIMITS ---
819
  position_limits = {
 
839
 
840
  # --- TEAM FILTER UI ---
841
  with st.expander("Team Filters"):
842
+ all_teams = sorted(handbuild_roo['Team'].unique())
843
  st.markdown("**Toggle teams to include:**")
844
  team_cols = st.columns(len(all_teams) // 2 + 1)
845
 
 
854
 
855
  # If no teams selected, show all teams
856
  if selected_teams:
857
+ player_select_df = handbuild_roo[
858
+ handbuild_roo['Team'].isin(selected_teams)
859
  ][['Player', 'Position', 'Team', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).sort_values(by='Order', ascending=True).copy()
860
  else:
861
+ player_select_df = handbuild_roo[['Player', 'Position', 'Team', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).copy()
862
 
863
  with st.expander("Quick Fill Options"):
864
  auto_team_var = st.selectbox("Auto Fill Team", options=all_teams)