I have a dataframe df1 with columns id1 and id2:
id1 id2
a1 b2
a6 b2
a3 c7
and another dataframe df2:
id f1 f2 f3 f4 f5
a1 0 1 0 0 1
a2 0 1 1 0 1
b2 1 1 0 0 1
a6 1 1 0 0 1
a3 1 0 0 0 0
c7 1 0 0 0 1
i want to add to df1 column names of df2 for those id's which are in id1 and id2 and have same value for the pair. So desired result is:
id1 id2 feature
a1 b2 f2,f5
a6 b2 f1,f2,f5
a3 c7 f1