from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X = LabelEncoder()
X[:, 0] = labelencoder_X.fit_transform(X[:, 0])
onehotencoder = OneHotEncoder(categorical_feature = [0])
X = onehotencoder.fit_transform(X).toarray()
错误在第四行,是的,我三遍检查了我的拼写
答案 0 :(得分:1)
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X = LabelEncoder()
X[:, 0] = labelencoder_X.fit_transform(X[:, 0])
onehotencoder = OneHotEncoder(categorical_feature = [0])
X = onehotencoder.fit_transform(X).toarray()
您可能在categorical_features争论中错过了一个“ s”。