类别类数据:
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
# TODO: Create a LabelEncoder object, which will turn all labels present in
# in each feature to numbers.
# HINT: Use LabelEncoder()
le = LabelEncoder()
# TODO: For each feature in X, apply the LabelEncoder's fit_transform
# function, which will first learn the labels for the feature (fit)
# and then change the labels to numbers (transform).
for feature in X:
# HINT: use fit_transform on X[feature] using the LabelEncoder() object
le.fit(X[feature])
X[feature] = le.transform(X[feature])# TODO
#print X
# TODO: Create a OneHotEncoder object, which will create a feature for each
# label present in the data.
# HINT: Use OneHotEncoder()
ohe = OneHotEncoder()
# TODO: Apply the