0

I have a dataframe. I want to convert a column called Date to a datetime type.

So I have the line below,

datesP = pd.to_datetime(df['Date'])

but when I check the type with the line below

datesP.dtype

I get, dtype of M8[ns] (there is a less than sign before the M but it cause issue when typing this post)

What am I missing why does this not return a datetime object?

mHelpMe
  • 6,336
  • 24
  • 75
  • 150
  • 3
    It is a datetime object, read [this](https://stackoverflow.com/questions/29206612/difference-between-data-type-datetime64ns-and-m8ns). Furthermore, in this case it would be easier to answer if you added some example data. – Erfan Sep 30 '19 at 19:24
  • Thanks, I'm just trying to plot some dates with matplotlib and wanted to check the dates formates I'm supplying it are correct as I'm having some issues – mHelpMe Sep 30 '19 at 19:33

0 Answers0