1

I am trying to perform a gorupby function on a dataframe without losing any of the other data.

Given the below dataframe:

color    name     size
 red      Jim      L
 red      Pam      S

I want to return like so:

color    name_x    name_y    size_x    size_y
 red       Jim      Pam        L         S

I figured just a simple groupby is all I needed to do but for some reason it doesn't work as planned.

df = df.groupby('color')

MaxB
  • 428
  • 1
  • 8
  • 24

0 Answers0