Skip to content

Instantly share code, notes, and snippets.

Created Feb 28, 2020
What would you like to do?
# Import label encoder
from sklearn import preprocessing
# label_encoder object knows how to understand word labels.
label_encoder = preprocessing.LabelEncoder()
# Encode labels in column 'Country'.
data['Country']= label_encoder.fit_transform(data[‘Country'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment