Creating line charts with Matplotlib

mport pandas as pd
import datetime as dt

unrate = pd.read_csv(‘unrate.csv’)
unrate[‘DATE’] =pd.to_datetime(unrate[‘DATE’])


In the above mentioned code. Why do we use pd.to_datetime because even after using to_datetime, the DATE column is still coming as object. even before it was object and after it is object, so what is the use of using that function. ?

Hey there!

The .describe() method only returns int,float, and object dtypes, so a datetime object would be wrapped into the general object dtype. While it’s technically correct, it’s not as granular as we’d like it to be.

A more accurate view of the dtypes in a df can be found by using the method or pulling out the dtypes attribute df.dtypes

Hope that helps!