Reputation: 581
I am unable to convert a string in the format 'YYYYMMDD' to a datetime object due to an error.
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 1-01-01 00:00:00
Here is some code snippets I am trying:
When I try to do:
data.move_date = pd.to_datetime(data.move_date)
I get the above error. Does anyone know how to fix this? Is this a bug? I did the same exact operation with another column that was in the string format and it worked perfectly.
Upvotes: 1
Views: 1178
Reputation: 1170
You can try this:
Adding @COLDSPEED answer
data['Dates'] = pd.to_datetime((data.move_data).apply(str),format='%Y%m%d', errors='coerce')
Upvotes: 2