James McCool
commited on
Commit
·
627d23a
1
Parent(s):
8a5b292
Refactor player location retrieval in exposure_spread function to iterate over columns for locating exposure_player, enhancing accuracy in player replacement logic.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -44,8 +44,12 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 44 |
for change in range(math.ceil(lineups_to_remove)):
|
| 45 |
for row in player_rows.index:
|
| 46 |
insert_player = random.choice(comparable_player_list)
|
| 47 |
-
|
| 48 |
-
working_frame.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
return working_frame
|
| 51 |
|
|
|
|
| 44 |
for change in range(math.ceil(lineups_to_remove)):
|
| 45 |
for row in player_rows.index:
|
| 46 |
insert_player = random.choice(comparable_player_list)
|
| 47 |
+
# Find which column contains the exposure_player
|
| 48 |
+
row_data = working_frame.iloc[row]
|
| 49 |
+
for col in working_frame.columns:
|
| 50 |
+
if row_data[col] == exposure_player:
|
| 51 |
+
working_frame.at[row, col] = insert_player
|
| 52 |
+
break
|
| 53 |
|
| 54 |
return working_frame
|
| 55 |
|