How to drop rows of Pandas DataFrame whose value in a certain column is NaN

前端 未结 12 845
一生所求
一生所求 2020-11-22 00:59

I have this DataFrame and want only the records whose EPS column is not NaN:

>>> df
                 STK_ID           


        
12条回答
  •  离开以前
    2020-11-22 01:19

    It may be added at that '&' can be used to add additional conditions e.g.

    df = df[(df.EPS > 2.0) & (df.EPS <4.0)]
    

    Notice that when evaluating the statements, pandas needs parenthesis.

提交回复
热议问题