# rangecounts table1 = [['foo', 'bar'], ['a', 3], ['a', 7], ['b', 2], ['b', 1], ['b', 9], ['c', 4], ['d', 3]] from petl import rangecounts, look look(table1) table2 = rangecounts(table1, 'bar', width=2) look(table2) # rangeaggregate table1 = [['foo', 'bar'], ['a', 3], ['a', 7], ['b', 2], ['b', 1], ['b', 9], ['c', 4], ['d', 3]] from petl import rangeaggregate, look, strjoin