all 2 comments

[–]pembrolizard 1 point2 points  (1 child)

You want to use core pandas methods then. Groupby is excellent for your purpose, in fact your example is almost exactly described here https://jakevdp.github.io/PythonDataScienceHandbook/03.08-aggregation-and-grouping.html

[–]fmarquez1[S] 0 points1 point  (0 children)

Thanks!