Issue with OneHotEncoder for categorical features

前端 未结 7 1383
耶瑟儿~
耶瑟儿~ 2020-12-05 13:20

I want to encode 3 categorical features out of 10 features in my datasets. I use preprocessing from sklearn.preprocessing to do so as the following:

<         


        
相关标签:
7条回答
  • 2020-12-05 14:05

    A comment to @piman314's answer (not enough reputation to make a comment)

    This problem only happens for sklearn version <= 0.19. Documentation of 0.19 for fit method only allows integer input:

    fit(X, y = None)

    X: Input array of type int.

    Later version (documentation of 0.20) automatically deal with the input datatype and allows string input

    fit(X, y = None)

    X: The data to determine the categories of each feature.

    0 讨论(0)
提交回复
热议问题