Miller (mlr) stats1: Aggregate Numbers in CSV
mlr stats1 computes sums, means, mins, maxes and percentiles over named fields, optionally grouped, directly on CSV or JSON.
Instead of loading a CSV into a spreadsheet or pandas, stats1 gives you grouped aggregates in one command, ideal for summarizing CI metrics.
What it does
mlr stats1 applies accumulators (-a) to value fields (-f), optionally split by group fields (-g). count-distinct counts unique combinations. Output is a record per group with one column per accumulator.
Common usage
# mean and max of duration, grouped by suite
mlr --csv stats1 -a mean,max -f duration -g suite results.csv
# total count of rows per status
mlr --csv count -g status results.csv
# 90th percentile of latency
mlr --csv stats1 -a p90 -f latency_ms metrics.csvOptions
| Flag | What it does |
|---|---|
| stats1 -a <accs> | Accumulators: sum, mean, min, max, count, stddev, p50, p90 |
| -f <fields> | Value fields to aggregate |
| -g <fields> | Group-by fields |
| count -g <f> | Count records per group |
| count-distinct -f <f> | Count distinct values of a field |
In CI
Summarize a flaky-test or timing report inside the job: mlr --csv stats1 -a mean,p90,max -f duration -g test results.csv turns raw rows into a per-test latency summary you can post to a PR comment without an external analytics step.
Common errors in CI
A typo in -f or -g does not error; Miller just emits empty or (error) values for that accumulator, so verify field names against the header first. Percentile accumulators are named p90, not 90th; mlr: ... unrecognized accumulator name flags a bad -a. Non-numeric data in a summed field yields (error) in the output cell rather than aborting.