James McCool
commited on
Commit
·
18eaa68
1
Parent(s):
7dd1418
Update exposure_spread function to utilize numpy for player location identification, enhancing accuracy in lineup adjustments by ensuring the correct player is replaced with a comparable player from the list.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import random
|
|
|
|
| 2 |
|
| 3 |
#### Goal is to choose a player and adjust the amount of lineups that have them
|
| 4 |
#### 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,8 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 38 |
|
| 39 |
# for each row, replace with random choice from comparable player list
|
| 40 |
for row in player_rows.index:
|
| 41 |
-
working_frame.
|
|
|
|
| 42 |
|
| 43 |
return working_frame
|
| 44 |
|
|
|
|
| 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
|
|
|
|
| 39 |
|
| 40 |
# for each row, replace with random choice from comparable player list
|
| 41 |
for row in player_rows.index:
|
| 42 |
+
player_location = np.where(working_frame.iloc[row] == exposure_player)
|
| 43 |
+
working_frame.at[player_location[0], player_location[1]] = random.choice(comparable_player_list)
|
| 44 |
|
| 45 |
return working_frame
|
| 46 |
|