Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
6029c0b
1
Parent(s):
8a49e0f
Implement change counter in exposure_spread function to limit player replacements based on lineups_to_remove, enhancing control over lineup adjustments.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -40,9 +40,11 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 40 |
print(player_rows.head(10))
|
| 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 |
-
|
| 46 |
insert_player = random.choice(comparable_player_list)
|
| 47 |
# Find which column contains the exposure_player
|
| 48 |
row_data = working_frame.iloc[row]
|
|
@@ -50,7 +52,6 @@ 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 |
-
|
| 55 |
return working_frame
|
| 56 |
|
|
|
|
| 40 |
print(player_rows.head(10))
|
| 41 |
print(working_frame.head(10))
|
| 42 |
|
| 43 |
+
change_counter = 0
|
| 44 |
+
|
| 45 |
# for each row to the the number of lineups to remove, replace with random choice from comparable player list
|
| 46 |
for row in player_rows.index:
|
| 47 |
+
if change_counter < math.ceil(lineups_to_remove):
|
| 48 |
insert_player = random.choice(comparable_player_list)
|
| 49 |
# Find which column contains the exposure_player
|
| 50 |
row_data = working_frame.iloc[row]
|
|
|
|
| 52 |
if row_data[col] == exposure_player:
|
| 53 |
working_frame.at[row, col] = insert_player
|
| 54 |
break
|
| 55 |
+
change_counter += 1
|
|
|
|
| 56 |
return working_frame
|
| 57 |
|