dataFrame问题

现有数据结构为,调用 describe 输出如下

               eps  min_samples   n_clusters    outliners        score
count  1161.000000  1161.000000  1161.000000  1161.000000  1161.000000
mean      0.065000     6.000000     7.664944    54.778639     0.448294
std       0.037254     2.583102    26.953035   185.646206     0.317491
min       0.001000     2.000000     1.000000     2.000000    -0.503024
25%       0.033000     4.000000     1.000000     2.000000     0.359631
50%       0.065000     6.000000     1.000000     6.000000     0.569632
75%       0.097000     8.000000     4.000000    23.000000     0.702620
max       0.129000    10.000000   488.000000  2084.000000     0.702620

的数据,我使用 result.loc[result['score'] == 0.702620]获取 score 最大值所在的行,返回的却是一个空的 dataFrame

Empty DataFrame
Columns: [eps, min_samples, n_clusters, outliners, score]
Index: []
阅读 1.7k
1 个回答

你看到的数字应该只是数字的前几位,所以判断不等。不建议你这么写,可以用 result.loc[result['score'].idxmax()] 代替。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题