I have a dataframe of 4X3 and want to pivot and then combine to avoid duplicate intersections.
Column A | Column B | Column C |
---|---|---|
boo | ptype | 123 |
boo | tecnh | 34e |
boo | ptype | 34w |
boo | staaa | 45r |
I have tried and couldn't pivot nor combine.
combined = line.apply(lambda row: ','.join(row.values.astype(str)), axis=1) (reference from stackoverflow)
Is there a way to pivot and combine to get the results as below?
Column A | ptype | tecnh | staaa |
---|---|---|---|
boo | 123,34w | 34e | 45r |