Skip to content

Instantly share code, notes, and snippets.

@Alakhator
Created Feb 28, 2020
Embed
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'])
print(data.head())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment