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:
<
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.