datamash -t, --header-in -g 3 count 4 sum 4 min 4 max 4 < data.csv

Category: Data Science & Analysis

datamash -t, --header-in -g 3 count 4 sum 4 min 4 max 4 < data.csv

Summarize column 4 with count, sum, min, and max per group

Combines four aggregations on column 4 inside one group-by on column 3: row count, sum, minimum, and maximum. This single command replaces a whole spreadsheet pivot table for per-category summaries. Any mix of operations can be listed this way, and each is computed over the same grouping. Add median 4 to the list for a fuller picture of each group's distribution.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.