I have a dataframe that has duplicate column names. I want to collapse all the same entries into a single one.
The csv data of the data would be,
You can use groupby by column names and aggregate sum:
print (df.groupby(level= 0, axis=1).sum())
col1 col2 id
0 2 0 'a'
1 1 1 'b'
2 1 0 'c'