How do I change the data type of a pandas Series?
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.
SUBSCRIBE to learn data science with Python:
JOIN the “Data School Insiders” community and receive exclusive rewards:
== RESOURCES ==
GitHub repository for the series: https://github.com/justmarkham/pandas-videos
“astype” documentation: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.astype.html
== LET’S CONNECT! ==