Converting string to datetime

The main thing here is that our dataset has a date column, but it shows up as an object or a string datatype. We will convert this into a proper datetime column.

We will use pandas' to_datetime method for this, which can parse a few different datetime formats:


We can see that our Date field has been changed from an object to datetime64, as shown in the following screenshot:

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.