James McCool commited on
Commit
b3ed56e
·
1 Parent(s): 84a7686

Limit concatenation in distribute_preset function to the top 10 entries of the working portfolio to enhance performance and maintain focus on the most relevant data.

Browse files
Files changed (1) hide show
  1. global_func/distribute_preset.py +1 -1
global_func/distribute_preset.py CHANGED
@@ -27,7 +27,7 @@ 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])
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
 
32
  if len(concat_portfolio) >= lineup_target:
33
  return concat_portfolio.sort_values(by='Finish_percentile', ascending=True).head(lineup_target)