James McCool
commited on
Commit
·
588f515
1
Parent(s):
06c4d25
Update portfolio distribution logic in distribute_preset.py to utilize 'Similarity Score' for maximum ownership type calculations. This change improves the accuracy of portfolio filtering by ensuring the correct comparison metric is applied, enhancing the overall trimming process.
Browse files
global_func/distribute_preset.py
CHANGED
@@ -22,13 +22,13 @@ def distribute_preset(portfolio: pd.DataFrame, lineup_target: int, exclude_cols:
|
|
22 |
if len(working_portfolio) == 0:
|
23 |
continue
|
24 |
elif len(working_portfolio) >= 1:
|
25 |
-
curr_own_type_max = working_portfolio.loc[0, '
|
26 |
|
27 |
for i in range(1, len(working_portfolio)):
|
28 |
-
if working_portfolio.loc[i, '
|
29 |
rows_to_drop.append(i)
|
30 |
else:
|
31 |
-
curr_own_type_max = working_portfolio.loc[i, '
|
32 |
|
33 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
34 |
concat_portfolio = pd.concat([concat_portfolio, working_portfolio.head(10)])
|
|
|
22 |
if len(working_portfolio) == 0:
|
23 |
continue
|
24 |
elif len(working_portfolio) >= 1:
|
25 |
+
curr_own_type_max = working_portfolio.loc[0, 'Similarity Score'] + (slack_var / 20 * working_portfolio.loc[0, 'Similarity Score'])
|
26 |
|
27 |
for i in range(1, len(working_portfolio)):
|
28 |
+
if working_portfolio.loc[i, 'Similarity Score'] < curr_own_type_max:
|
29 |
rows_to_drop.append(i)
|
30 |
else:
|
31 |
+
curr_own_type_max = working_portfolio.loc[i, 'Similarity Score'] + (slack_var / 20 * working_portfolio.loc[i, 'Similarity Score'])
|
32 |
|
33 |
working_portfolio = working_portfolio.drop(rows_to_drop).reset_index(drop=True)
|
34 |
concat_portfolio = pd.concat([concat_portfolio, working_portfolio.head(10)])
|