DEV Community

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

Posted on

1 1

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)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️