mrdbourke / zero-to-mastery-ml

All course materials for the Zero to Mastery Machine Learning and Data Science course.
https://dbourke.link/ZTMmlcourse
2.88k stars 3.4k forks source link

fix 'feature names must be in the same order as they were in fit' #61

Closed arpadikuma closed 1 year ago

arpadikuma commented 1 year ago

added the code: df_test = df_test[X_train.columns]

to fix: 'feature names must be in the same order as they were in fit'

which occurs because df_test's order of columns is different from X_train's order at the time of .fit() @mrdbourke

(I have only edited the non-video version of the ipynb, wasn't sure I should touch the video one!)