James McCool
commited on
Commit
·
2c35cf4
1
Parent(s):
8125d78
Sort working portfolio by 'median' before resetting index in distribute_preset.py to enhance player selection accuracy. This change ensures that the highest median values are prioritized in the distribution process.
Browse files
global_func/distribute_preset.py
CHANGED
@@ -60,7 +60,7 @@ def distribute_preset(portfolio: pd.DataFrame, lineup_target: int, exclude_cols:
|
|
60 |
lambda row: not any(player in list(row) for player in player_out), axis=1
|
61 |
)
|
62 |
working_portfolio = working_portfolio[remove_mask]
|
63 |
-
working_portfolio = working_portfolio.reset_index(drop=True)
|
64 |
curr_own_type_max = working_portfolio.loc[0, 'Similarity Score'] + (slack_var / 20 * working_portfolio.loc[0, 'Similarity Score'])
|
65 |
|
66 |
for i in range(1, len(working_portfolio)):
|
|
|
60 |
lambda row: not any(player in list(row) for player in player_out), axis=1
|
61 |
)
|
62 |
working_portfolio = working_portfolio[remove_mask]
|
63 |
+
working_portfolio = working_portfolio.sort_values(by='median', ascending=False).reset_index(drop=True)
|
64 |
curr_own_type_max = working_portfolio.loc[0, 'Similarity Score'] + (slack_var / 20 * working_portfolio.loc[0, 'Similarity Score'])
|
65 |
|
66 |
for i in range(1, len(working_portfolio)):
|