I write the following code,
Here I attached the code image
from sklearn.preprocessing import OneHotEncoder ohe = OneHotEncoder(categorical_features=[0])
and it gives me, TypeError: OneHotEncoder.init() got an unexpected keyword argument 'categorical_features'
I tried to creating, OneHotEncoder object with keyword argument. But it gives me TypeError
The error is telling you that the init
function for the class does not take a keyword argument with that name. The documentation says this:
class sklearn.preprocessing.OneHotEncoder(*, categories='auto', drop=None, sparse='deprecated', sparse_output=True, dtype=<class 'numpy.float64'>, handle_unknown='error', min_frequency=None, max_categories=None, feature_name_combiner='concat')
found at https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html.