为什么 unique() returns 值相同?

why does unique() returns the same value?

考虑具有名为“quantile0.1_mrp”的列的测试数据框。 为什么 unique() returns 2 个相同的值?

编辑:(正如@jezrael 评论的那样,这是因为精度)

问题在于浮点数的精度,pandas/numpy有时会显示截断的值。

你可以检查它是否转换为列表。

print (list(test['quantile0.1_mrp'].unique()))

可能的解决方案是取整值:

print (test['quantile0.1_mrp'].round().unique())