Reputation: 45
I have generated a Pivot Table in VisiData, and I want to collapse the rows.
Data that looks like:
20 ║ 360 | 0 | 0 ║
20 ║ 0 | 299 | 0 ║
20 ║ 0 | 0 | 17 ║
19 ║ 0 | 711 | 0 ║
19 ║ 586 | 0 | 0 ║
19 ║ 0 | 0 | 59 ║
18 ║ 0 | 1054| 0 ║
18 ║ 905 | 0 | 0 ║
18 ║ 0 | 0 | 82 ║
I want it to be:
20 ║ 360 ║ 299 ║ 17 ║
19 ║ 586 ║ 711 ║ 59 ║
...
I've tried various aggregation methods, but none of them seem to be working.
Upvotes: 1
Views: 119
Reputation: 45
I have followed the instructions on Group in the VisiData documentation and asked in the IRC channel.
What worked was to add a 'max' aggregation on the (last) three columns and then hit Shift+F which gives a table like:
t #║ F_max# | N_max# | C_max# ║
10 ║ 22 | 29 | 2 ║
11 ║ 806 | 1162 | 98 ║
12 ║ 248 | 288 | 18 ║
13 ║ 137 | 130 | 8 ║
14 ║ 824 | 888 | 58 ║
15 ║ 567 | 779 | 41 ║
16 ║ 514 | 359 | 304 ║
17 ║ 421 | 263 | 13 ║
18 ║ 905 | 1054 | 82 ║
19 ║ 586 | 711 | 59 ║
20 ║ 360 | 299 | 17 ║
Upvotes: 1