You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何统计DataFrame中prediction列大于77.36的数值数量?

统计DataFrame中prediction列大于77.36的行数

下面是两种高效实现统计的方法:

  • 直接对布尔序列求和
    布尔值在Python中会被当作1(True)和0(False)处理,因此可以直接对筛选条件生成的布尔序列求和:

    count = (df['prediction'] > 77.36).sum()
    print(count)
    
  • 筛选后获取子DataFrame的行数
    先筛选出符合条件的记录,再通过shape[0]或len()获取行数:

    filtered_df = df[df['prediction'] > 77.36]
    count = filtered_df.shape[0]
    # 也可以用 len(filtered_df) 实现相同效果
    print(count)
    

内容的提问来源于stack exchange,提问作者Colton Seegmiller

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 08:48:14