I have a pandas dataframe as below. I want to logically check multiple columns (A,B,C) and update column D with OR operation and update the column names which has true by comma separating in column E. I am not sure on how to achieve it. Any leads will be helpful.
A B C D E
True True True True A,B,C
True False True True A,C
False False False False NA
False False True True C
Edit :
cols = ['A','B','C']
df['D'] = np.where(df[cols].eq(True).any(1), True, False)
I am able to come up with column D but not sure how to proceed with Column E