Contribute Media
A thank you to everyone who has made this possible: Read More

How do I create dummy variables in pandas?


If you want to include a categorical feature in your machine learning model, one common solution is to create dummy variables. In this video, I'll demonstrate three different ways you can create dummy variables from your existing DataFrame columns. I'll also show you a trick for simplifying your code that was introduced in pandas 0.18.

This is video 24 of 30 in the series, Easier data analysis in Python with pandas. The notebook and datasets shown in the video are available on GitHub.

Improve this page