Drop rows with all zeros in pandas data frame

前端 未结 13 1217
礼貌的吻别
礼貌的吻别 2020-11-27 11:57

I can use pandas dropna() functionality to remove rows with some or all columns set as NA\'s. Is there an equivalent function for drop

13条回答
  •  生来不讨喜
    2020-11-27 12:44

    I look up this question about once a month and always have to dig out the best answer from the comments:

    df.loc[(df!=0).any(1)]
    

    Thanks Dan Allan!

提交回复
热议问题