How to group dataframe rows into list in pandas groupby

Given a dataframe, I want to groupby the first column and get second column as lists in rows, so that a dataframe like:

a b
A 1
A 2
B 5
B 5
B 4
C 6

becomes

A [1,2]
B [5,5,4]
C [6]

How do I do this?

← Назад к списку