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
Files changed (1) hide show
  1. global_func/distribute_preset.py +3 -3
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, 'Weighted Own'] + (slack_var / 20 * working_portfolio.loc[0, 'Weighted Own'])
26
 
27
  for i in range(1, len(working_portfolio)):
28
- if working_portfolio.loc[i, 'Weighted Own'] > curr_own_type_max:
29
  rows_to_drop.append(i)
30
  else:
31
- curr_own_type_max = working_portfolio.loc[i, 'Weighted Own'] + (slack_var / 20 * working_portfolio.loc[i, 'Weighted Own'])
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)])