如何在没有所有行的情况下获取值7599?
app_train[app_train["target"]==1].count()
userkn_answernumcnt_cuishou 7599
userkn_answernumcnt_nonphonenoremark 7599
userkn_answernumcnt_noremark 7599
userkn_answernumcntdavg 7599
userkn_answertimescnt_bank 7599
userkn_answertimescnt_cuishou 7599
userkn_answertimescnt_nonphonenoremark 7599
userkn_answertimescnt_noremark 7599
userkn_answertimescnt_xiaodai 7599
userkn_answertimescnt_xiaodaibank 7599
userkn_answertimescnt_zhongjie 7599
userkn_answertimescntdavg 7599
userkn_answertimescntrate_bank 7599
userkn_answertimescntrate_xiaodai 7599
userkn_answertimescntrate_xiaodaibank 7599
userkn_answerxiaodaibanknumcnt 7599
userkn_answerxiaodaibanknumdmax 7599
答案 0 :(得分:0)
如果要按条件计数行数,请使用布尔掩码的sum
:
(app_train["target"]==1).sum()