James McCool commited on
Commit
268badd
·
1 Parent(s): 67af571

Refactor exposure_spread function to improve player replacement logic by directly accessing player locations using column indices, enhancing code clarity and performance.

Browse files
Files changed (1) hide show
  1. global_func/exposure_spread.py +2 -2
global_func/exposure_spread.py CHANGED
@@ -40,8 +40,8 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
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
- player_location = np.where(working_frame.iloc[row] == exposure_player)
44
- working_frame.at[row, player_location[1]] = random.choice(comparable_player_list)
45
 
46
  return working_frame
47
 
 
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
+ player_location = player_rows.columns.get_loc(exposure_player)
44
+ working_frame.iloc[row, player_location] = random.choice(comparable_player_list)
45
 
46
  return working_frame
47