Data Science, Machine Learning, Causal Inference, AI, Linear Programming.
cost best_df = pd.concat([best_value, best_cost], axis=1) best_df.columns = ["value", "cost"] best_df = best_df.sort_values(by=['value'], ascending=False).reset_index(drop=True) # Naive optimisation best_df_cum = best_df.cumsum() opt_index = best_df_cum['cost'].searchsorted(max_cost)