我的 pandas 数据框如下所示:
col_1 | col_2 | col_3 .... col_100
date
01-01-2001 True False False ... True
02-01-2001 False True False ... True
03-01-2001 True False True ... True
04-01-2001 False False False ... False
因此,我想得到一个 df,其中包含行中至少有一个 True 的所有行。在这种情况下,结果将是
col_1 | col_2 | col_3 ... col_100
date
01-01-2001 True False False ... True
02-01-2001 False True False ... True
03-01-2001 True False True ... False
有什么聪明的方法可以做到这一点吗?
最佳答案
关于python - 根据 bool 列过滤 pandas 数据框行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69434981/