James McCool
commited on
Commit
·
698043b
1
Parent(s):
50f79c6
Refactor player selection logic in distribute_preset.py to improve clarity by explicitly defining columns used for player masking. This change enhances the readability of the code and ensures that only relevant columns are considered during the player filtering process.
Browse files
global_func/distribute_preset.py
CHANGED
@@ -32,7 +32,9 @@ def distribute_preset(portfolio: pd.DataFrame, lineup_target: int, exclude_cols:
|
|
32 |
player_list.update(init_portfolio[cols].unique())
|
33 |
|
34 |
for player in player_list:
|
35 |
-
|
|
|
|
|
36 |
lambda row: player in list(row), axis=1
|
37 |
)
|
38 |
|
|
|
32 |
player_list.update(init_portfolio[cols].unique())
|
33 |
|
34 |
for player in player_list:
|
35 |
+
# Select only the columns that are NOT in excluded_cols
|
36 |
+
player_cols = [col for col in init_portfolio.columns if col not in excluded_cols]
|
37 |
+
player_mask = init_portfolio[player_cols].apply(
|
38 |
lambda row: player in list(row), axis=1
|
39 |
)
|
40 |
|