在运行此代码时,使用Anaconda Python 2.7.12和Pandas 18.1在Windows Server 2012上:
我遇到了这个错误:
df['z'] = df['y'].str.replace(' ', '').astype(int)
我遇到了这个错误:
OverflowError: Python int too large to convert to C long
在MacOS 10.11或Ubuntu 14.04上我没有遇到这个错误。我从其他地方读到说,Windows C++编译器对long的定义与类Unix操作系统不同。如果是这样,我该如何在Windows上使它工作?
此外,data.txt文件大小仅为172 KB。如果有帮助的话,data.txt的格式如下:
x|y
99999917|099999927 9991
99999911|999999979 9994
99999912|999999902 9992
.astype('int64')
- 在Windows上,int
始终为32位。 - chrisb