I am getting a DataFrame.dtypes
error while following the last steps of this tutorial.
Here is my code:
import xgboost as xgb
regr = xgb.XGBRegressor(colsample_bytree=0.2,
gamma=0.0,
learning_rate=0.05,
max_depth=6,
min_child_weight=1.5,
n_estimators=7200,
reg_alpha=0.9,
reg_lambda=0.6,
subsample=0.2,
seed=42,
silent=1)
regr.fit(train_new, label_df)
And this is the error I am receiving:
ValueErrorTraceback (most recent call last)
<ipython-input-64-010296d611e9> in <module>()
12 silent=1)
13
---> 14 regr.fit(train_new, label_df)
D:\anacodna\lib\site-packages\xgboost\sklearn.pyc in fit(self, X, y, sample_weight, eval_set, eval_metric, early_stopping_rounds, verbose, xgb_model, sample_weight_eval_set, callbacks)
358 missing=self.missing, nthread=self.n_jobs)
359 else:
--> 360 trainDmatrix = DMatrix(X, label=y, missing=self.missing, nthread=self.n_jobs)
361
362 evals_result = {}
D:\anacodna\lib\site-packages\xgboost\core.pyc in __init__(self, data, label, missing, weight, silent, feature_names, feature_types, nthread)
378 data, feature_names, feature_types = _maybe_pandas_data(data,
379 feature_names,
--> 380 feature_types)
381
382 data, feature_names, feature_types = _maybe_dt_data(data,
D:\anacodna\lib\site-packages\xgboost\core.pyc in _maybe_pandas_data(data, feature_names, feature_types)
237 msg = """DataFrame.dtypes for data must be int, float or bool.
238 Did not expect the data types in fields """
--> 239 raise ValueError(msg + ', '.join(bad_fields))
240
241 if feature_names is None:
ValueError: DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in fields Alley, Condition2, Electrical, GarageType, GarageYrBlt, Heating, LandContour, LandSlope, LotShape, MiscFeature, PavedDrive, RoofMatl, Street, Utilities