2017-11-13 7 views
-1

와 astype (int)에 대한 I 파이썬에서 다음 번호가 :오버플로 큰 숫자

import pandas 
x = pandas.Series(1508770848527.423339843750000) 

나는 내가 갖는 x.astype(int)을 적용있을 때 나는 1508770848527.0을 받고 있지만있어 x.apply(np.floor)을 사용하고 있습니다 - 2147483648.

이 오버플로를 방지하려면 어떻게해야합니까? 숫자를 정수로 사용하고 싶습니다. int64

+1

'x.astype (np.int64)'. –

답변

1

변환 :

print (x.astype('int64')) 
0 1508770848527 
dtype: int64 

또는 같은이 Willem Van Onsem 주석 :

print (x.astype(np.int64)) 
0 1508770848527 
dtype: int64