James McCool
commited on
Commit
·
ee185e5
1
Parent(s):
3a20f4f
Refactor exposure_spread function to improve readability by consolidating conditional checks for stacking sports and comparable players filtering.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -272,13 +272,13 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 272 |
(projections_df['salary'] <= comp_salary_high + (salary_max - working_frame['salary'][row])) &
|
| 273 |
(projections_df['position'].apply(lambda x: has_position_overlap(x, comp_player_position)))
|
| 274 |
]
|
| 275 |
-
if sport_var in stacking_sports:
|
| 276 |
if sport_var in stacking_sports:
|
| 277 |
-
if
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
| 282 |
|
| 283 |
if remove_teams is not None:
|
| 284 |
remove_mask = comparable_players.apply(
|
|
|
|
| 272 |
(projections_df['salary'] <= comp_salary_high + (salary_max - working_frame['salary'][row])) &
|
| 273 |
(projections_df['position'].apply(lambda x: has_position_overlap(x, comp_player_position)))
|
| 274 |
]
|
|
|
|
| 275 |
if sport_var in stacking_sports:
|
| 276 |
+
if sport_var in stacking_sports:
|
| 277 |
+
if working_frame.iloc[row]['Size'] == 5 and comp_team != working_frame.iloc[row]['Stack']:
|
| 278 |
+
remove_mask = comparable_players.apply(
|
| 279 |
+
lambda player_row: not any(team in list(player_row) for team in [working_frame.iloc[row]['Stack']]), axis=1
|
| 280 |
+
)
|
| 281 |
+
comparable_players = comparable_players[remove_mask]
|
| 282 |
|
| 283 |
if remove_teams is not None:
|
| 284 |
remove_mask = comparable_players.apply(
|