Python 3.x 为什么value_counts()[:10]会抛出错误?
我有一列浮点整数索引Python 3.x 为什么value_counts()[:10]会抛出错误?,python-3.x,pandas,count,Python 3.x,Pandas,Count,我有一列浮点整数索引 file['Id'].dtypes => dtype('float64') 计算最大值时,它不会抛出错误,但如果我尝试检索前10个索引,它会抛出一个值错误: counts = pd.DataFrame(file['Id'].value_counts().copy(deep = True)) -> no error counts = pd.DataFrame(file['Id'].value_counts()[:10].copy(deep = True)) -&
file['Id'].dtypes => dtype('float64')
计算最大值时,它不会抛出错误,但如果我尝试检索前10个索引,它会抛出一个值错误:
counts = pd.DataFrame(file['Id'].value_counts().copy(deep = True)) -> no error
counts = pd.DataFrame(file['Id'].value_counts()[:10].copy(deep = True)) -> error
ValueError: index must be monotonic increasing or decreasing
During handling of the above exception, another exception occurred:
我们需要通过@rafaelc查看数据这里是正确工作的计数索引:ID(1002.05797.002054.0,…):count(4278403294,…)