James McCool
commited on
Commit
·
67af571
1
Parent(s):
db663df
Update exposure_spread function to ensure the number of lineups to remove is rounded up using math.ceil, enhancing the accuracy of player replacement from the comparable player list.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import random
|
| 2 |
import numpy as np
|
|
|
|
| 3 |
|
| 4 |
#### Goal is to choose a player and adjust the amount of lineups that have them
|
| 5 |
#### First thing you need to do is find comparable players in the projections, so any player in the projections that is within $500 of the player and within 10% of the projection
|
|
@@ -38,7 +39,7 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 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 |
|
|
|
|
| 1 |
import random
|
| 2 |
import numpy as np
|
| 3 |
+
import math
|
| 4 |
|
| 5 |
#### Goal is to choose a player and adjust the amount of lineups that have them
|
| 6 |
#### First thing you need to do is find comparable players in the projections, so any player in the projections that is within $500 of the player and within 10% of the projection
|
|
|
|
| 39 |
player_rows = working_frame[player_mask]
|
| 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 |
|