如何使用“转换”获得转换;OverflowerError:Python int太大,无法转换为C long“;在Windows Server 2012上工作时出错?

如何使用“转换”获得转换;OverflowerError:Python int太大,无法转换为C long“;在Windows Server 2012上工作时出错?,python,c++,pandas,numpy,anaconda,Python,C++,Pandas,Numpy,Anaconda,在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++编译器的定义比Unix

在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++编译器的定义比Unix类OS长。如果是,我如何在Windows上工作

此外,data.txt的大小只有172 KB。如果有帮助,data.txt采用以下形式:

x|y
99999917|099999927 9991
99999911|999999979 9994
99999912|999999902 9992

numpy将
int
解释为
np.int
dtype,它对应于一个C整数。在Windows上,即使在64位系统上,这也是一个32位整数

因此,如果需要强制转换较大的值,请使用

.astype('int64')

试试
.astype('int64')
——在Windows上,
int
总是32位的。这样就行了。回答这个问题,我会接受的。