删除列值小于0的Pandas数据帧行

2024-06-16 09:56:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经阅读了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()的不同组合,但没有找到任何有效的方法。


Tags: the数据答案indfnanthis线程