I want to make a calculation for each item in a list. Then, I want to add these new values to a column in a dataframe. The name of the column should be: name_item This is what I have so far:
list_thr = [0.1, 0.5]
for n in list_thr:
y_scores = (best_classifier.predict_proba(X_test)[:,1]>=n).astype(int)
probs_score = best_classifier.predict_proba(X_test)
df_final['preds'] = y_scores #df_final is the dataframe I want to put the columns
However, if I keep it, the column 'preds' will be replaced in each iteraction. What I want is 1 column for each iteraction and with "n" in the name, such as:
df_final:
preds_0.1 preds_0.5
1 1
0 0
0 1
0 0
1 1
How can I change my loop to get that?