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

前端 未结 12 1019
一生所求
一生所求 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:21

    I know this has already been answered, but just for the sake of a purely pandas solution to this specific question as opposed to the general description from Aman (which was wonderful) and in case anyone else happens upon this:

    import pandas as pd
    df = df[pd.notnull(df['EPS'])]
    

提交回复
热议问题