How to add new column in my test_set datafram?

Question:

How to add true_prediction variable to the test data

test['prediction'] = true_prediction

but it’s not added as a new column, as shown in myresult_pic

How to make the test data accept it as a new column!!

Asked By: Merahamad

||

Answers:

Could it be ‘test’ is not a dataframe?

Try:

test = pd.DataFrame(test)
test['prediction'] = true_prediction
Answered By: Paul