为什么value_counts()[:10]会引发错误?

时间:2019-12-12 04:54:04

标签: python-3.x pandas count

我有一列浮点整数索引

file['Id'].dtypes => dtype('float64')

在计算最高值时,它不会抛出错误,但是如果我尝试检索前十个索引,则会抛出值错误:

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:

0 个答案:

没有答案