Master Categorical Data Encoding with Scikit-learn's OrdinalEncoder & OneHotEncoder 📊

Learn how to effectively convert categorical variables into numerical format using Scikit-learn's OrdinalEncoder and OneHotEncoder. Boost your machine learning models with these essential preprocessing techniques!

learndataa•1.2K views•31:24

About this video

The video discusses the intuition and code to numerically encode categorical data using OrdinalEncoder() and OneHotEncoder() in Scikit-learn in Python. Timeline (Python 3.8) 00:00 - Outline of video 00:36 - What are categorical features? 01:30 - Why is there a need to encode categorical features? 03:09 - What are ordered categories? 04:09 - Code snippet 05:52 - Open Jupyter notebook 06:06 - Data 06:21 - OrdinalEncoder(): (default) categories='auto' 10:01 - OrdinalEncoder(): categories= -*custom order*- 12:30 - OneHotEncoder(): (default) 16:20 - OneHotEncoder(): specify list of categories 20:35 - OneHotEncoder(): handle_unknown='ignore' 22:27 - OneHotEncoder(): drop='if_binary' 26:25 - DictVectorizer(): one hot encode categories from a dictionary 29:21 - Collinearity: Matrix with determinant = zero 30:42 - Ending notes ######## # Data ######## game = [ ['first', 'gold', 'top'], ['second', 'silver', 'middle'], ['third', 'bronze', 'bottom'] ] x = [ ['football', 'helmet', 'ground'], ['basketball', 'shoes', 'net'], ['cricket', 'bat', 'pitch'], ['tennis', 'band', 'court'] ] h = [ ['male', 'truck', 'blue'], ['female', 'car', 'green'], ['male', 'bike', 'gray'] ] plants = [ {'fruit': 'pear', 'weight': 178.}, {'fruit': 'pomegranate', 'weight': 250.}, {'fruit': 'cherry', 'weight': 5.} ]

Tags and Topics

This video is tagged with the following topics. Click any tag to explore more related content and discover similar videos:

Tags help categorize content and make it easier to find related videos. Browse our collection to discover more content in these categories.

4.5

1 user review

Write a Review

0/1000 characters

User Reviews

0 reviews

Be the first to comment...

Video Information

Views
1.2K

Total views since publication

Likes
25

User likes and reactions

Duration
31:24

Video length

Published
Dec 17, 2020

Release date

Quality
hd

Video definition

Related Trending Topics

LIVE TRENDS

This video may be related to current global trending topics. Click any trend to explore more videos about what's hot right now!

THIS VIDEO IS TRENDING!

This video is currently trending in Malaysia under the topic 'bwf japan masters 2025'.

Share This Video

SOCIAL SHARE

Share this video with your friends and followers across all major social platforms including X (Twitter), Facebook, Youtube, Pinterest, VKontakte, and Odnoklassniki. Help spread the word about great content!