I am trying to make the following transformation in python
from
A B C D E
x 1 0 0 0
y 0 1 1 0
z 1 0 0 1
to
x B
y C,D
z A,E
Do you have any ideas ?
Check with dot
df=df.set_index('A')
df.dot(df.columns+',').str[:-1]
A
x B
y C,D
z B,E
dtype: object