One Hot & Dummy Encoding in Python ML 🐍
Learn how to use One Hot and Dummy Encoding with Pandas and Sklearn for machine learning in Python, explained by Dr. Mahesh Huddar.

Mahesh Huddar
5.1K views • Apr 21, 2022

About this video
One Hot Encoding and Dummy Encoding Machine Learning Python Pandas SkLearn by Dr. Mahesh Huddar
One Hot Encoding:
In one-hot encoding, we create a new set of dummy (binary) variables that is equal to the number of categories (k) in the variable.
For example, let’s say we have a categorical variable Color with three categories called “Red”, “Green” and “Blue”, we need to use three dummy variables to encode this variable using one-hot encoding.
A dummy (binary) variable just takes the value 0 or 1 to indicate the exclusion or inclusion of a category.
Dummy encoding
Dummy encoding also uses dummy (binary) variables.
Instead of creating a number of dummy variables that is equal to the number of categories (k) in the variable, dummy encoding uses k-1 dummy variables.
To encode the same Color variable with three categories using the dummy encoding, we need to use only two dummy variables.
********************************
1. Blog / Website: https://www.vtupulse.com/
2. Like Facebook Page: https://www.facebook.com/VTUPulse
3. Follow us on Instagram: https://www.instagram.com/vtupulse/
4. Like, Share, Subscribe, and Don't forget to press the bell ICON for regular updates
One Hot Encoding:
In one-hot encoding, we create a new set of dummy (binary) variables that is equal to the number of categories (k) in the variable.
For example, let’s say we have a categorical variable Color with three categories called “Red”, “Green” and “Blue”, we need to use three dummy variables to encode this variable using one-hot encoding.
A dummy (binary) variable just takes the value 0 or 1 to indicate the exclusion or inclusion of a category.
Dummy encoding
Dummy encoding also uses dummy (binary) variables.
Instead of creating a number of dummy variables that is equal to the number of categories (k) in the variable, dummy encoding uses k-1 dummy variables.
To encode the same Color variable with three categories using the dummy encoding, we need to use only two dummy variables.
********************************
1. Blog / Website: https://www.vtupulse.com/
2. Like Facebook Page: https://www.facebook.com/VTUPulse
3. Follow us on Instagram: https://www.instagram.com/vtupulse/
4. Like, Share, Subscribe, and Don't forget to press the bell ICON for regular updates
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
5.1K
Likes
73
Duration
8:44
Published
Apr 21, 2022
User Reviews
4.5
(1) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.