datamash -t, --header-in geomean 2 harmmean 2 < data.csv

Category: Data Science & Analysis

datamash -t, --header-in geomean 2 harmmean 2 < data.csv

Compute geometric and harmonic means of column 2

The geomean (geometric mean) suits growth rates and ratios, while harmmean (harmonic mean) suits rates and speeds, both of which the plain arithmetic mean handles poorly. Each operation is another statistic datamash can compute in the same one-line pass. Rate-of-change data and averaged speeds are the classic use cases. Use plain mean for everyday averages.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.