Changing the datatype of a pandas series

In this section, we'll learn about changing the datatype of a pandas series. We'll see how to change datatypes after reading the data within. We'll also learn how to change datatypes while reading data in pandas. We'll walk through an example of changing an int column to float. We'll also see how to convert a string values column to the datetime datatype.

We will start by importing the pandas module and reading the dataset of house prices from zillow.com into the Jupyter Notebook:

data = pd.read_table('data-zillow.csv', sep=',')data.head()

The following is the output:

Get Mastering Exploratory Analysis with pandas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.