I've tried re-searching on stack over but couldn't get a solution for my problem
I want to concatenate the columns if they have the same column name:
Example:
input = { 'A' : [0,1,0,1,0], 'B' : [0,1,1,1,1], 'C':[1,1,1,1,0],
'D' : [1,1,0,0,0], 'E' : [1,0,1,0,1]}
df = pd.DataFrame(input)
df.columns = ['A','B','C','C','B']
A B C C B
0 0 0 1 1 1
1 1 1 1 1 0
2 0 1 1 0 1
3 1 1 1 0 0
4 0 1 0 0 1
Desired output:
A B C
0 0 0;1 1;1
1 1 1;0 1;1
2 0 1;1 1;0
3 1 1;0 1;0
4 0 1;1 0;0
Any pointers are highly appreciated.