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
#3
(Oct-14-2019, 11:59 AM)perfringo Wrote: You should pass date format parameter to pandas.to_datetime.

YYYY-mm-dd -> '%Y-%m-%d' -> format='%Y-%m-%d'

Thanks, but I have tried it specifying these formats in a few different ways, and it continues to return the same error "ValueError: to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing"

The pandas.to_datetime documentation states that it should take an argument as 'integer, float, string, datetime, list, tuple, 1-d array, Series'. Does a df.column meet any of these definitions, or does it need to be converted into a Series or np.array or something first?
Reply


Messages In This Thread
RE: Convert df column to datetime format - by LarsCordes - Oct-14-2019, 12:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I convert time-series data in rows into column srvmig 0 2,084 Apr-11-2020, 05:40 AM
Last Post: srvmig
  Convert dataframe string column to numeric in Python darpInd 1 2,311 Mar-14-2020, 10:07 AM
Last Post: ndc85430
  Combine a number into integer column and preserv format as number zinho 2 1,941 Dec-23-2019, 05:02 PM
Last Post: zinho
  itertuples, new column, datetime, pandas karlito 6 3,994 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