fit(y) Fit label encoder
fit_transform(y) Fit label encoder and return encoded labels
fit 返回一个实例
fit_transform 返回 和y一样的形状
from sklearn import preprocessing
le = preprocessing.LabelEncoder()
city = le.fit_transform(["paris", "paris", "tokyo", "amsterdam"])
print city
得到一列 [1 1 2 0]
from sklearn import preprocessing
le = preprocessing.LabelEncoder()
city = le.fit(["paris", "paris", "tokyo", "amsterdam"])
print city
得到LabelEncoder()