In the above examples, each value in a categorical variable represents a different category.
#How to do one hot encoding in pandas code
I get questions all the time about some concepts in machine learning and what they really mean, for example, in one of my previous articles Google’s 7 steps of Machine Learning in practice, I get asked what is one-hot encoding, and when should we use it? That’s is a great question and every machine learning practitioner needs to know the answer, so let’s talk about it and dive into some code with Pandas get_dummies(). Photo by Hope House Press - Leather Diary Studio on Unsplash