📅  最后修改于: 2022-03-11 14:55:43.934000             🧑  作者: Mango
>>> df = DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
>>> 'foo', 'bar', 'foo', 'foo'],
... 'B' : ['one', 'one', 'two', 'three',
... 'two', 'two', 'one', 'three'],
... 'C' : randn(8), 'D' : randn(8)})
>>> grouped = df.groupby('A')
>>> grouped
>>> test = grouped.aggregate(np.sum)
>>> test
C D
A
bar -1.852376 2.204224
foo -3.398196 -0.045082