DEV Community

Cover image for Manage Categorial Data of Dataset
Remon Hasan
Remon Hasan

Posted on

Manage Categorial Data of Dataset

encoding categorial data

import LabelEncoder Class of Sklearn

from sklearn.preprocessing import LabelEncoder

create object of LabelEncoder

labelencoder_X = LabelEncoder()

labeling the object

labelencoder_X.fit_transform(X[:, 0])

now put it into the country column

X[:, 0] = labelencoder_X.fit_transform(X[:, 0])

Then Print

print(X)

Top comments (0)