Python pandas-选择列子集的布尔筛选为true的行

Python pandas-选择列子集的布尔筛选为true的行,python,pandas,null,Python,Pandas,Null,我有一个数据帧'df',我想从中选择3个特定列不为null的子集 到目前为止,我已经尝试应用布尔过滤 mask_df = df[['Empty', 'Peak', 'Full']].notnull() 这给了我以下的结果 Empty Peak Full 0 True False False 1 False False False 2 True True True 3 False False False 4 False

我有一个数据帧'df',我想从中选择3个特定列不为null的子集

到目前为止,我已经尝试应用布尔过滤

mask_df = df[['Empty', 'Peak', 'Full']].notnull()
这给了我以下的结果

    Empty   Peak    Full
0   True    False   False
1   False   False   False
2   True    True    True
3   False   False   False
4   False   False   False
... ... ... ...
2775244 True    True    True
2775245 True    True    True
2775246 False   False   False
2775247 False   False   False
2775248 False   False   False
现在,我只想选择这3列的掩码为True的行(即,这3列具有null值的行)。如果我用这个掩码过滤原始数据帧'df',我会得到原始数据帧中充满空值的数据帧,除了那些掩码_df为“True”的数据帧

我可能可以通过按行应用lambda函数来实现这一点,但如果有更简单的方法,我更愿意避免这种计算

提前谢谢

使用:


请与预期输出共享一个示例数据框Yes please@TiagoPedroThanks!这就是我要找的。
df[mask_df.all(axis = 1)]