Python Pandas find all rows where all values are NaN

后端 未结 3 809
囚心锁ツ
囚心锁ツ 2020-12-06 01:16

So I have a dataframe with 5 columns. I would like to pull the indices where all of the columns are NaN. I was using this code:

nan = pd.isnull(df.all)
         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-06 01:34

    From the master himself: https://stackoverflow.com/a/14033137/6664393

    nans = pd.isnull(df).all(1).nonzero()[0]
    

提交回复
热议问题