[英]OverflowError: Python int too large to convert to C long when converting to datetime
I'm reading an excel file with Pandas. 我正在用Pandas阅读Excel文件。 One column has dates like this:
20160210
一栏中的日期是这样的:
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. 临时而言,我怀疑某些代码会错误地假设
long
会在任何地方都是64位,而在Windows编译器上,即使是x86-64 CPU,它也是32位。
You wouldn't be doing this on Windows by any chance, possibly with Python 3.5.0? 您不会在Windows上这样做,可能是使用Python 3.5.0吗? There was a recurrence of the Y2K38 bug for Windows builds when they were adding support for nanosecond timestamp precision .
当Windows版本添加对纳秒级时间戳精度的支持时,会再次出现Y2K38错误 。 If that's not the case, I would suspect something wrong on Pandas' side, in the same manner.
如果不是这种情况,我会以同样的方式怀疑熊猫的一面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.