I would like a way to perform grouping and aggregate functions when my source data isn\'t already grouped nicely. For example, given the following dataframe: