Search code examples
pandastableau-desktop

How to convert object into datetime in Pandas


I'm playing around with Pandas and Tableau to create time series from UK unemployment stats.

I've carved the data and have something like this:

Index  Date      Count
158    1992 APR 501
159    1992 MAY 507
160    1992 JUN 509
161    1992 JUL 509

Want to use pd.to_datetime() method but it keeps coming back with error:

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

Solution

  • I corrected the date object to following and it works:

    pd.to_datetime(df['Date'])