-2

I am facing following errors here. I have already update all library and im using vscode. But can't findout the solution of the problem.

from sklearn.preprocessing import LabelEncoder , OneHotEncoder
y=rooms_df['room type'].values
y_labelencoder = LabelEncoder ()
y = y_labelencoder.fit_transform (y)
y=y.reshape(-1,1)
onehotencoder = OneHotEncoder(categorical_features=[0])
Y= onehotencoder.fit_transform(y)
Y.shape 

it says "OneHotEncoder.init() got an unexpected keyword argument 'categorical_features'" at line code

onehotencoder = OneHotEncoder(categorical_features=[0])

can u guys help me to solve it?

  • 1
    Does this answer your question? [OneHotEncoder categorical\_features deprecated, how to transform specific column](https://stackoverflow.com/questions/54345667/onehotencoder-categorical-features-deprecated-how-to-transform-specific-column) – luk2302 Jul 09 '22 at 09:44

1 Answers1

0

I have never used this library before but I just read that the categorical_features keyword is deprecated. maybe you will find this answer useful : https://stackoverflow.com/a/54362051/16822178

nir
  • 46
  • 2