James McCool
commited on
Commit
·
efe0fbf
1
Parent(s):
47d93c4
Enhance portfolio concatenation in distribute_preset function by increasing the limit to the top 10 entries and adding a step to remove duplicates based on 'median', 'salary', and 'Own' for improved data relevance and accuracy.
Browse files
global_func/distribute_preset.py
CHANGED
@@ -27,7 +27,8 @@ def distribute_preset(portfolio: pd.DataFrame, lineup_target: int, exclude_cols:
|
|
27 |
curr_own_type_max = working_portfolio.loc[i, 'Weighted Own'] + (slack_var / 20 * working_portfolio.loc[i, 'Weighted Own'])
|
28 |
|
29 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
30 |
-
concat_portfolio = pd.concat([concat_portfolio, working_portfolio.head(
|
|
|
31 |
|
32 |
if len(concat_portfolio) >= lineup_target:
|
33 |
return concat_portfolio.sort_values(by='Finish_percentile', ascending=True).head(lineup_target)
|
|
|
27 |
curr_own_type_max = working_portfolio.loc[i, 'Weighted Own'] + (slack_var / 20 * working_portfolio.loc[i, 'Weighted Own'])
|
28 |
|
29 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
30 |
+
concat_portfolio = pd.concat([concat_portfolio, working_portfolio.head(10)])
|
31 |
+
concat_portfolio = concat_portfolio.drop_duplicates(subset=['median', 'salary', 'Own'])
|
32 |
|
33 |
if len(concat_portfolio) >= lineup_target:
|
34 |
return concat_portfolio.sort_values(by='Finish_percentile', ascending=True).head(lineup_target)
|