I have a pandas data frame
df = pd.DataFrame({'id':[1,2,3,4],
'attr1':[1,1,0,0],
'attr2':[0,1,1,0],
'attr3':[1,1,1,0],
'attr4':[1,1,1,1]})
I want to convert it to
Basically create a new variable which will contain previous dataframe columns if its value is 1

