简体   繁体   中英

OverflowError: Python int too large to convert to C long when converting to datetime

I'm reading an excel file with Pandas. One column has dates like this: 20160210

I want to convert to datetime objects, so:

t = pd.to_datetime(dataframe['date'], format='%Y%m%d')

The following error arises:

OverflowError: Python int too large to convert to C long

Any idea?

Off-hand, I'd suspect some code that mistakenly assumes that long will be 64 bits everywhere, when on Windows compilers, it's 32 bits, even when targeting x86-64 CPUs.

You wouldn't be doing this on Windows by any chance, possibly with Python 3.5.0? There was a recurrence of the Y2K38 bug for Windows builds when they were adding support for nanosecond timestamp precision . If that's not the case, I would suspect something wrong on Pandas' side, in the same manner.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM