Python Forum
Convert df column to datetime format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert df column to datetime format
#1
Hi all,

I'm trying to convert a dataframe column to a datetime format using
pd.to_datetime(dataframe.column,infer_datetime_format=True)


The column contains some 2,000 dates formatted YYYY-mm-dd. However, when I pass the relevant column, I receive the following error:

ValueError: to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing

Is there something different I need to do in order to ensure the df column is formatted correctly before passing to the to_datetime function?

Thanks for any help, this is really frustrating me!
Reply


Messages In This Thread
Convert df column to datetime format - by LarsCordes - Oct-14-2019, 10:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I convert time-series data in rows into column srvmig 0 2,080 Apr-11-2020, 05:40 AM
Last Post: srvmig
  Convert dataframe string column to numeric in Python darpInd 1 2,309 Mar-14-2020, 10:07 AM
Last Post: ndc85430
  Combine a number into integer column and preserv format as number zinho 2 1,939 Dec-23-2019, 05:02 PM
Last Post: zinho
  itertuples, new column, datetime, pandas karlito 6 3,988 Nov-29-2019, 11:07 AM
Last Post: karlito

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020