Pivot tables for CSV files in the terminal.
Part of a set of terminal-based CSV tools, also including [CSV Match] (https://github.com/maxharlow/csvmatch) and [CSV Bar] (https://github.com/maxharlow/csvbar).
Tested on Python 2.7 and 3.5.
pip install csvpivot
Say you have a CSV file such as:
We could then find the average salary in each country:
$ csvpivot test.csv --rows country --values 'mean(salary)'
It would be useful to find out the maximum and minimum values too though:
$ csvpivot test.csv --rows country --values 'mean(salary)' 'min(salary)' 'max(salary)'
As well as `mean`, `min`, and `max`, CSV Pivot also supports `median`, `sum`, `stddev`, `count`, `countuniq`, `concat`, and `concatuniq`. All require numerical values apart from the last two. If numbers contain commas they are interpreted as thousands separators and removed.
Columns are also supported. So we could break down out data by gender:
$ csvpivot test.csv --rows country --values 'mean(salary)' --columns gender
TODO: Brief introduction on what you do with files - including link to relevant help section.