Scikit-Learn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)

  python, scikit-learn

enter image description here
Please, help. I’m trying to encode the ‘Embarked’ column by OneHotEncoder from Scikit-Learn.
I’ve tryed to run this code and got that error. What’s wrong?

from sklearn.preprocessing import OneHotEncoder

onehotencoder = OneHotEncoder(categories = 11)
df = onehotencoder.fit_transform(df).toarray()

Source: Python Questions

LEAVE A COMMENT