I am having an issue with .predict()
in python. I am using RandomForestRgressor and having an issue predicting the dependent values of the test set. I have first called train_cats(df)
on the dataframe and then split the dependent and independent value using proc_df()
. I then proceeded to split my dataframe into a training set and a validation set. I created a RandomForestRegressor object and fit the independent and dependent values. I imported the test set. Ran train_cats() and proc_df() just like I did on the training set. I then called .predict() on the test set and it threw this error: ValueError: setting an array element with a sequence.
Can someone help me fix this here are the last few lines of the code. And here is the complete code: https://pastebin.pl/view/2f45a8e4
df_test = pd.read_csv('Housing_test.csv', low_memory=False,
parse_dates=["YearBuilt", "YearRemodAdd"])
add_datepart(df_test, 'YearBuilt')
add_datepart(df_test, 'YearRemodAdd')
train_cats(df_test)
df_1 = proc_df(df_test)
y_test= m.predict(df_1)