Skip to main content

## pivot

The pivot command provides simple pivot table functionality.

Flag | Req'd? | Description
-c field | Yes | Field to use for column headers.
-r field | Yes | Field to use for row headers.
-f field | Yes | Fact field.
-a action | Yes | Action to perform on fact field - must be one of sum, avg or count.

For example, you could use the command to process the pivot.csv data (which represents sales of foods for different sales areas) to summarise the data like this:

csvfix pivot -c 2 -r 1 -f 4 -a sum data/pivot.csv

which says that you want the column headers in the output to be the food names, the row headers to be the sales areas, the fact field to be the numbers of sales, and the operation to perform on the fact field to be addition. This produces the output:

"","beans","bread","rice"

"north","37","7","13"

"south","31","21","10"

Created with the Personal Edition of HelpNDoc: Produce electronic books easily

####