I have a variable ['date_hiring'] in Googlespeedsheet in format like
16.01.2016
I import it in Python, the variable has an object type. I try to convert to datetime
from datetime import datetime
data['date_hiring'] = pd.to_datetime(data['date_hiring'])
and i get
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 16-01-06 00:00:00
i know from this pandas out of bounds nanosecond timestamp after offset rollforward plus adding a month offset that
Since pandas represents timestamps in nanosecond resolution, the timespan that can be represented using a 64-bit integer is limited to approximately 584 years
but in original data in the Googlespeedsheet i have no data like '16.01.06'
Just like '16.06.2006'
So the problem is in converting
How to improve it?
According to the documentation, the dayfirst field defaults to false:
dayfirst : boolean, default False
So it must have decided that there was a malformed date there and tried to interpret it as a time-of-day.
But even then it probably didn't think that 16 point anything could be hours or minutes, so it tried to convert it as seconds. But there is a extra decimal point so it gave up and said I don't like the fractional seconds. (Or something like that.)
I think you can fix it by giving an explicit format string or at least setting dayfirst.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With