from sklearn import preprocessing
le = preprocessing.LabelEncoder()
le.fit(["paris", "paris", "tokyo", "amsterdam"])
print('class:{}'.format(list(le.classes_)))
data1 = ["tokyo", "tokyo", "paris"]
print(le.transform(data1))
data2 = ["tokyo", "tokyo", "paris", "USA", "Taiwan"]
print(le.transform(data2))