Here's a sample dataframe:
label data
a 1.09
b 2.1
a 5.0
b 2.0
c 1.9
What I want is
arr = [[1.09, 5.0], [2.1, 2.0],[1.9]]
preferably as a list of numpy arrays.
I know that df.groupby.groups.keys()
gives me the list ['a','b','c']
, and df.groupby.groups.values()
gives me something like arr
, but as an Int64Index
object. However, I tried df.loc[df.groupby.groups.values()]['label']
and it isn't getting the desired result.
How do I accomplish this? Thanks!