mlr --csv count-distinct -f dept data.csv

Category: Data Science & Analysis

mlr --csv count-distinct -f dept data.csv

Count distinct dept values with a header row

The count-distinct verb counts how many unique values appear in the fields named by -f, here dept. Output includes a header line naming the field and the count unless -n is given. This is a fast category census for any column of a CSV. Add more fields to -f to count distinct combinations instead.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.