James McCool commited on
Commit
db663df
·
1 Parent(s): 3c80a10

Refactor exposure_spread function to iterate over the number of lineups to remove, ensuring correct player replacement from the comparable player list. This change improves the logic for player adjustments in lineups.

Browse files
Files changed (1) hide show
  1. global_func/exposure_spread.py +3 -5
global_func/exposure_spread.py CHANGED
@@ -37,12 +37,10 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
37
  # isolate the rows that contain the player
38
  player_rows = working_frame[player_mask]
39
 
40
- # for each row, replace with random choice from comparable player list
41
- for row in player_rows.index:
42
  player_location = np.where(working_frame.iloc[row] == exposure_player)
43
- print(working_frame.iloc[row])
44
- print(player_location)
45
- working_frame.at[player_location[0], player_location[1]] = random.choice(comparable_player_list)
46
 
47
  return working_frame
48
 
 
37
  # isolate the rows that contain the player
38
  player_rows = working_frame[player_mask]
39
 
40
+ # for each row to the the number of lineups to remove, replace with random choice from comparable player list
41
+ for row in range(lineups_to_remove):
42
  player_location = np.where(working_frame.iloc[row] == exposure_player)
43
+ working_frame.at[row, player_location[1]] = random.choice(comparable_player_list)
 
 
44
 
45
  return working_frame
46