Skip to content

Instantly share code, notes, and snippets.

@Alakhator
Created February 28, 2020 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alakhator/8140533f340c3d7e01de400060a03ed4 to your computer and use it in GitHub Desktop.
Save Alakhator/8140533f340c3d7e01de400060a03ed4 to your computer and use it in GitHub Desktop.
# 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