简体   繁体   中英

Delete Pandas dataframe row, where the sum of all columns equals to 0

有没有办法可以删除pandas数据帧中的所有行,其中所有列的总和等于0?

您可以更改逻辑 - 使用boolean indexing选择sum不等于0所有列:

df = df[df.sum(axis=1).ne(0)]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM