How can I quickly drop rows where A, B and C are all false? I tried:
df3 = df[~(~(df['A'])& ~(df['B']) & ~(df['C']) )]
df3
com A B C
0 as TRUE FALSE FALSE
1 da TRUE FALSE FALSE
drop rows where A, B and C are are all false
With df.sum across axis=1 along with comparison if sum in the row for these coumns is not equal to 0 , using df.ne
out = df[df[['A','B','C']].sum(1).ne(0)].copy()
A,B,C , if there is any True value, it will return 1 or more , hence I check if the sum is not equal to zero (which means all columns for a row is False)False&False&False (which is False) ( assuming all the columns in the row is False) , then you invert it (~) which will always return True so for rows having all False values it still returns True and hence doesnot drop itWait a mins any
df[df[['A','B','C']].any(1)]