James McCool
commited on
Commit
·
a44a243
1
Parent(s):
627d23a
Refactor exposure_spread function to adjust the iteration order for player replacements, ensuring that all player rows are processed before making changes, which enhances the logic for lineup adjustments.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -41,8 +41,8 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 41 |
print(working_frame.head(10))
|
| 42 |
|
| 43 |
# for each row to the the number of lineups to remove, replace with random choice from comparable player list
|
| 44 |
-
for
|
| 45 |
-
for
|
| 46 |
insert_player = random.choice(comparable_player_list)
|
| 47 |
# Find which column contains the exposure_player
|
| 48 |
row_data = working_frame.iloc[row]
|
|
@@ -50,6 +50,7 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 50 |
if row_data[col] == exposure_player:
|
| 51 |
working_frame.at[row, col] = insert_player
|
| 52 |
break
|
|
|
|
| 53 |
|
| 54 |
return working_frame
|
| 55 |
|
|
|
|
| 41 |
print(working_frame.head(10))
|
| 42 |
|
| 43 |
# for each row to the the number of lineups to remove, replace with random choice from comparable player list
|
| 44 |
+
for row in player_rows.index:
|
| 45 |
+
for change in range(math.ceil(lineups_to_remove)):
|
| 46 |
insert_player = random.choice(comparable_player_list)
|
| 47 |
# Find which column contains the exposure_player
|
| 48 |
row_data = working_frame.iloc[row]
|
|
|
|
| 50 |
if row_data[col] == exposure_player:
|
| 51 |
working_frame.at[row, col] = insert_player
|
| 52 |
break
|
| 53 |
+
break
|
| 54 |
|
| 55 |
return working_frame
|
| 56 |
|