Created
February 28, 2020 13:42
-
-
Save Alakhator/8140533f340c3d7e01de400060a03ed4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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