删除列值为<的Pandas DataFrame行0

时间:2013-11-11 12:04:20

标签: python pandas

我已经在this帖子中阅读了答案,但它没有回答我的确切问题。 我的DataFrame看起来像这样

                      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()的不同组合,但找不到任何有效的方法。

2 个答案:

答案 0 :(得分:19)

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

答案 1 :(得分:1)

yum update