Deleting DataFrame row in Pandas based on column value

前端 未结 10 2234
悲哀的现实
悲哀的现实 2020-11-22 04:08

I have the following DataFrame:

             daysago  line_race rating        rw    wrating
 line_date                                                 
 2007         


        
10条回答
  •  孤独总比滥情好
    2020-11-22 04:32

    But for any future bypassers you could mention that df = df[df.line_race != 0] doesn't do anything when trying to filter for None/missing values.

    Does work:

    df = df[df.line_race != 0]
    

    Doesn't do anything:

    df = df[df.line_race != None]
    

    Does work:

    df = df[df.line_race.notnull()]
    

提交回复
热议问题