Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete Pandas DataFrame row where column value is < 0

Tags:

python

pandas

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

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.

like image 644
Lukas Spieß Avatar asked Nov 11 '13 12:11

Lukas Spieß


1 Answers

df = df[df['Correlation'] >= 0]
like image 50
waitingkuo Avatar answered Sep 20 '22 17:09

waitingkuo