While using XGBRegressor() model for a housing price prediction, I have 13 features and target is price.
I have done the train test split but while fitting X_train data in model, I am getting below error.
ValueError: DataFrame for label cannot have multiple columns
All of the feature columns have only numerical data, so why getting this issue? Is it because of string data type of column name.
Please help!
This is not about the features or column names. The error message is saying that when calling the fitting method, you passed a dataframe with more than one column as the
y
value. Buty
should be a one-dimensional vector, i.e. just one column. So make sure that you pass just the price column asy
.I'm assuming you are using the scikit-learn interface, where all the fitting methods for supervised learning methods expect
X
andy
as input,X
being the feature matrix andy
the target or label vector.