mapping back any sklearn result to the original dataframe

1.8k views Asked by At

I'd like to analyze the predicted values of my random forest results in excel with the original test data as a reference.

The predicted result comes in an array as i use this:

predict = rf.predict(test[columns])

how do I map back the predicted results to the original dataset using pandas?

Regards, galeej

1

There are 1 answers

0
galeej On BEST ANSWER

EdChum's answered the question.

(Edit) His answer:

You should be able to just add this back as a new column: test['prediction'] = rf.predict(test[columns])

My apologies for the delay.

Regards, Sunil