onehotencoder 28categorical features 3d

Solutions on MaxInterview for onehotencoder 28categorical features 3d by the best coders in the world

showing results for - "onehotencoder 28categorical features 3d"
Carl
02 Jan 2019
1#Encoding the categorical data
2from sklearn.preprocessing import LabelEncoder
3
4labelencoder_X = LabelEncoder()
5X[:,0] = labelencoder_X.fit_transform(X[:,0])
6
7#we are dummy encoding as the machine learning algorithms will be
8#confused with the values like Spain > Germany > France
9from sklearn.preprocessing import OneHotEncoder
10
11onehotencoder = OneHotEncoder(categorical_features=[0])
12X = onehotencoder.fit_transform(X).toarray()