James McCool commited on
Commit
f9fb038
·
1 Parent(s): efac5fb

Refactor exposure_spread function to iterate over player rows for replacements, enhancing the logic for player adjustments and ensuring all relevant lineups are updated with comparable players.

Browse files
Files changed (1) hide show
  1. global_func/exposure_spread.py +6 -5
global_func/exposure_spread.py CHANGED
@@ -39,11 +39,12 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
39
  player_rows = working_frame[player_mask]
40
 
41
  # for each row to the the number of lineups to remove, replace with random choice from comparable player list
42
- for row in range(math.ceil(lineups_to_remove)):
43
- insert_player = random.choice(comparable_player_list)
44
- player_location = list(player_rows.iloc[row]).index(exposure_player)
45
- working_frame.at[row, player_location] = insert_player
46
- print(working_frame.at[row, player_location])
 
47
 
48
  return working_frame
49
 
 
39
  player_rows = working_frame[player_mask]
40
 
41
  # for each row to the the number of lineups to remove, replace with random choice from comparable player list
42
+ for change in range(math.ceil(lineups_to_remove)):
43
+ for row in player_rows.index:
44
+ insert_player = random.choice(comparable_player_list)
45
+ player_location = list(working_frame.iloc[row]).index(exposure_player)
46
+ working_frame.at[row, player_location] = insert_player
47
+ print(working_frame.at[row, player_location])
48
 
49
  return working_frame
50