James McCool commited on
Commit
53b3878
·
1 Parent(s): fe4a9c1

Refactor player selection logic in app.py to accommodate dynamic auto size

Browse files

MLB_DFS_ROO/app.py
Updated the logic for selecting players in the 'Wrap (7-2)' condition to handle varying 'auto_size_var' values. This change improves the flexibility of player selection based on the specified size, enhancing the overall functionality of the application.

Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -971,7 +971,12 @@ with tab4:
971
  elif auto_range_var == 'Mid (4-8)':
972
  selected_players = team_players[team_players['Order'] > 0].iloc[3:3 + auto_size_var - 1]
973
  elif auto_range_var == 'Wrap (7-2)':
974
- first_three = team_players[team_players['Order'] > 0].head(2)
 
 
 
 
 
975
  last_two = team_players[team_players['Order'] > 0].tail(3)
976
  selected_players = pd.concat([first_three, last_two])
977
  else:
 
971
  elif auto_range_var == 'Mid (4-8)':
972
  selected_players = team_players[team_players['Order'] > 0].iloc[3:3 + auto_size_var - 1]
973
  elif auto_range_var == 'Wrap (7-2)':
974
+ if auto_size_var == 5:
975
+ first_three = team_players[team_players['Order'] > 0].head(2)
976
+ elif auto_size_var == 4:
977
+ first_three = team_players[team_players['Order'] > 0].head(1)
978
+ elif auto_size_var == 3:
979
+ first_three = team_players[team_players['Order'] > 0].head(0)
980
  last_two = team_players[team_players['Order'] > 0].tail(3)
981
  selected_players = pd.concat([first_three, last_two])
982
  else: