删除列值<的Pandas DataFrame行. 0 [英] Delete Pandas DataFrame row where column value is < 0

查看:100
本文介绍了删除列值<的Pandas DataFrame行. 0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在中阅读了答案线程,但不能回答我的确切问题. 我的DataFrame看起来像这样

I already read the answers in this thread but it doesn't answer my exact problem. My DataFrame looks like this

                      Lady in the Water  The Night Listener  Just My Luck  Correlation
Claudia Puig                    NaN                 4.5           3.0     0.893405
Gene Seymour                    3.0                 3.0           1.5     0.381246
Jack Matthews                   3.0                 3.0           NaN     0.662849
Lisa Rose                       2.5                 3.0           3.0     0.991241
Michael Phillips                2.5                 4.0           NaN    -1.000000
Mick LaSalle                    3.0                 3.0           2.0     0.924473

并且我想删除Michael Phillips的行,因为他的相关值低于零. 如前所述,我尝试了df = df[df.Correlation]df = df.drop()的不同组合,但找不到任何有效的方法.

and i want to delete Michael Phillips' row since his correlation value is below zero. As said, I tried different combinations of df = df[df.Correlation] and df = df.drop()but couldn't find anything that worked.

推荐答案

df = df[df['Correlation'] >= 0]

这篇关于删除列值<的Pandas DataFrame行. 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆