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

How do I change the data type of a pandas Series?

Description

Have you ever tried to do math with a pandas Series that you thought was numeric, but it turned out that your numbers were stored as strings? In this video, I'll demonstrate two different ways to change the data type of a Series so that you can fix incorrect data types. I'll also show you the easiest way to convert a boolean Series to integers, which is useful for creating dummy/indicator variables for machine learning.

This is video 13 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