James McCool
commited on
Commit
·
a768a6b
1
Parent(s):
c5323ea
Refactor player filtering logic in exposure_spread function to directly apply a mask for removing rows without the exposure_player, enhancing clarity and ensuring accurate player selection during exposure calculations.
Browse files
global_func/exposure_spread.py
CHANGED
|
@@ -333,12 +333,12 @@ def exposure_spread(working_frame, exposure_player, exposure_target, exposure_st
|
|
| 333 |
lambda row: not any(team in list(row) for team in remove_teams), axis=1
|
| 334 |
)
|
| 335 |
comparable_players = comparable_players[remove_mask]
|
| 336 |
-
|
| 337 |
-
# Get the current row data to check for existing players
|
| 338 |
-
current_row_data = working_frame.iloc[row]
|
| 339 |
|
| 340 |
-
|
| 341 |
-
|
|
|
|
|
|
|
|
|
|
| 342 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 343 |
|
| 344 |
# Create a list of comparable players
|
|
|
|
| 333 |
lambda row: not any(team in list(row) for team in remove_teams), axis=1
|
| 334 |
)
|
| 335 |
comparable_players = comparable_players[remove_mask]
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
+
remove_mask = working_frame.apply(
|
| 338 |
+
lambda row: exposure_player not in list(row), axis=1
|
| 339 |
+
)
|
| 340 |
+
working_frame = working_frame[remove_mask]
|
| 341 |
+
|
| 342 |
comparable_players = comparable_players[comparable_players['player_names'] != exposure_player]
|
| 343 |
|
| 344 |
# Create a list of comparable players
|