我正在尝试在 Pandas Dataframe 中插入长整数
import numpy as np
from pandas import DataFrame
data_scores = [(6311132704823138710, 273), (2685045978526272070, 23), (8921811264899370420, 45), (17019687244989530680L, 270), (9930107427299601010L, 273)]
dtype = [('uid', 'u8'), ('score', 'u8')]
data = np.zeros((len(data_scores),),dtype=dtype)
data[:] = data_scores
df_crawls = DataFrame(data)
print df_crawls.head()
但是当我查看数据框时,最后一个很长的值现在是负数:
uid分数 0 6311132704823138710 273 1 2685045978526272070 23 2 8921811264899370420 45 3 -1427056828720020936 270 4 -8516636646409950606 273
uid 是 64 位无符号整数,所以 'u8' 应该是正确的 dtype 吗?有任何想法吗 ?