Creating non-numeric pivot tables with VisiData (recipe three)
Viva Enrico Bergamini
Published in
2 min readDec 29, 2018
As Enrico has written in his recipe one:
If you ever tried to pivot a table containing non-numeric values, you have surely been struggling with any spreadsheet app to do it easily.
He has proposed a recipe to do it, using Python pandas and pivot_table function.
In this second recipe of mine (the first one is this) I will us VisiData. The goal of Enrico is to change the original table as the image below:
These are the steps:
- run
vd tidy.csv
(here the example file); - go over the
id
field and set it as key field using!
; - go over the
Value
field and addmax
aggregator to it, using+
key; - go over the
Variable
field and pressShift+W
; - hide the two “Total” output columns, using
-
.
The output will be something like:
That’s all. Last thing could be rename the fields.