0

I'm working on a classification model and I want to append the model's output (0 or 1) back to the dataframe as a new column (model_op). Here's the dataframe sample -

Salary Age Education Holiday
25000 33 2 Y
32200 36 3 N
38200 38 3 Y
29200 30 2 Y
21200 22 1 N

I want to add back the model results for each individual row to the dataframe based on a condition like this -

   if <condition>:
      df['model_op'] == 0
   else:
      df['model_op'] == 1
Salary Age Education Holiday model_op
25000 33 2 Y 1
32200 36 3 N 0
38200 38 3 Y 1
29200 30 2 Y 1
21200 22 1 N 0

Thanks in advance for your help

0 Answers0