0

I'm new to python so the question might not be so clear.

I have this dataset with pandas dataframe that goes something like this.

        Id       item
0      A0029V93  B0239WN
1      A0029V93  B0302SS
2      A02948s8  B0029ST
...

and the result I want is

        Id       item
0      A0029V93  (B0239WN,B0302SS)
1      A02948s8  (B0029ST, ...)
2      ...       ...
...

No duplicate Id and all the items in the data paired with the ID It doesn't necessarily have to look like this as long as I can get the Id,[item] data.

CCC
  • 13
  • 4

1 Answers1

1
df.groupby('Id')['item'].apply(list)
mjspier
  • 6,386
  • 5
  • 33
  • 43