James McCool commited on
Commit
5b493e6
·
1 Parent(s): 27339c2

Enhance position mapping logic in app.py for FLEX columns based on site selection. Implemented conditional mapping for Draftkings and Fanduel, allowing for separate handling of FLEX1 and FLEX2 positions. This improves the accuracy of position counts in simulations.

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -549,7 +549,12 @@ with tab1:
549
  with tab2:
550
  if 'Sim_Winner_Display' in st.session_state:
551
  # Apply position mapping to FLEX column
552
- flex_positions = st.session_state.freq_copy['FLEX'].map(st.session_state.maps_dict['Pos_map'])
 
 
 
 
 
553
 
554
  # Count occurrences of each position in FLEX
555
  flex_counts = flex_positions.value_counts()
 
549
  with tab2:
550
  if 'Sim_Winner_Display' in st.session_state:
551
  # Apply position mapping to FLEX column
552
+ if st.session_state.site_var1 == 'Draftkings':
553
+ flex_positions = st.session_state.freq_copy['FLEX'].map(st.session_state.maps_dict['Pos_map'])
554
+ elif st.session_state.site_var1 == 'Fanduel':
555
+ flex1_positions = st.session_state.freq_copy['FLEX1'].map(st.session_state.maps_dict['Pos_map'])
556
+ flex2_positions = st.session_state.freq_copy['FLEX2'].map(st.session_state.maps_dict['Pos_map'])
557
+ flex_positions = pd.concat([flex1_positions, flex2_positions])
558
 
559
  # Count occurrences of each position in FLEX
560
  flex_counts = flex_positions.value_counts()