There are no limits to the kinds of reductions we might want to apply to grouped data. We might have data with a number of independent and dependent variables. We can consider partitioning the data by an independent variable and computing summaries such as maximum, minimum, average, and standard deviation of the values in each partition.
The essential trick to doing more sophisticated reductions is to collect all of the data values into each group. The Counter() function merely collects counts of identical items. We want to create sequences of the original items based on a key value.
Looked at it in a more general way, each five-mile bin will contain the entire collection of legs of that distance, ...