itheenigma commited on
Commit
2a07b79
·
1 Parent(s): 7d3e93d

fixing issues where 'marginal_cpc_HAS' referenced before assignment

Browse files
Files changed (1) hide show
  1. marginal_cpc_calculator.py +3 -3
marginal_cpc_calculator.py CHANGED
@@ -134,10 +134,10 @@ def calculate_max_spend(df,min_date,max_date,
134
  else:
135
  marginal_cpc,cum_clicks,cum_cpc,cum_revenue = df_marginal.loc[df_marginal.cumulative_cost==max_spend_threshold,
136
  ['marginal_cpc','cum_clicks','cum_cpc','cum_revenue']].values[0]
137
- marginal_cpc_HAS,cum_clicks_HAS,cum_cpc_HAS,cum_revenue_HAS = df_marginal.loc[df_marginal.cumulative_cost==highest_amount_spent,
138
- ['marginal_cpc','cum_clicks','cum_cpc','cum_revenue']].values[0]
139
  # any spend beyond the max_spend_threshold needs to be saved
140
- total_negative_roas_spend = df_temp.loc[df_temp.cum_cost>max_spend_threshold,['cost']].sum().values[0]
 
 
141
  # # so to get the max cost for this tactic or strategy,
142
  if pprint==True:
143
  output_msg.append(f"Max spend threshold is: {max_spend_threshold}")
 
134
  else:
135
  marginal_cpc,cum_clicks,cum_cpc,cum_revenue = df_marginal.loc[df_marginal.cumulative_cost==max_spend_threshold,
136
  ['marginal_cpc','cum_clicks','cum_cpc','cum_revenue']].values[0]
 
 
137
  # any spend beyond the max_spend_threshold needs to be saved
138
+ total_negative_roas_spend = df_temp.loc[df_temp.cum_cost>max_spend_threshold,['cost']].sum().values[0]
139
+ marginal_cpc_HAS,cum_clicks_HAS,cum_cpc_HAS,cum_revenue_HAS = df_marginal.loc[df_marginal.cumulative_cost==highest_amount_spent,
140
+ ['marginal_cpc','cum_clicks','cum_cpc','cum_revenue']].values[0]
141
  # # so to get the max cost for this tactic or strategy,
142
  if pprint==True:
143
  output_msg.append(f"Max spend threshold is: {max_spend_threshold}")