pandas dataframe drop columns by number of nan

后端 未结 5 792
忘了有多久
忘了有多久 2021-01-04 02:08

I have a dataframe with some columns containing nan. I\'d like to drop those columns with certain number of nan. For example, in the following code, I\'d like to drop any co

5条回答
  •  迷失自我
    2021-01-04 02:31

    I recommend the drop-method. This is an alternative solution:

    dff.drop(dff.loc[:,len(dff) - dff.isnull().sum() <2], axis=1)
    

提交回复
热议问题