Shivangi Shah
Shivangi Shah

Reputation: 11

How can I fix this error with sklearn.preprocessing?

Code:

onehotencoder = OneHotEncoder(categorical_features = [3])

resulting in the error:

TypeError: __init__() got an unexpected keyword argument 'categorical_features'

Upvotes: 0

Views: 149

Answers (1)

Harmon758
Harmon758

Reputation: 5157

As Chris said, the categorical_features parameter for preprocessing.OneHotEncoder was deprecated with version 0.20 of scikit-learn. See the relevant release notes, commit, pull request, and issue for the deprecation. It was then removed in version 0.22. See the PR and commit for the removal.

Upvotes: 1

Related Questions