from sklearn import preprocessing le = preprocessing.LabelEncoder() y_numeric_label = le.fit_transform(y_text_label) y_numeric_label