I have a dataframe that has all unique columns, however, I have to rename the columns with their field alias after creation. Some field aliases are duplicates, in this case, those columns need to be joined together to one column. It's worth noting that in either case, the values could be strings or integers as well as contain special characters.
Type Type Project ID
0 AS3 112 1
1 AS4 131 2
2 AS5 115 3
3 AS6 191 4
4 AS7 100 5
When I use df.groupby(df.columns, axis=1) I end up with an empty dataframe. But I'm assuming that's because groupby returns a dataframegroupby which isn't an actual dataframe? Is there an easy way to do this so my output is:
Type Project ID
0 AS3 112 1
1 AS4 131 2
2 AS5 115 3
3 AS6 191 4
4 AS7 100 5