Esempio n. 1
0

# rangefacet

table1 = [['foo', 'bar'],
          ['a', 3],
          ['a', 7],
          ['b', 2],
          ['b', 1],
          ['b', 9],
          ['c', 4],
          ['d', 3]]

from petl import rangefacet, look
look(table1)
rf = rangefacet(table1, 'bar', 2)
rf.keys()
look(rf[(1, 3)])
look(rf[(7, 9)])


# transpose

table1 = (('id', 'colour'),
          (1, 'blue'),
          (2, 'red'),
          (3, 'purple'),
          (5, 'yellow'),
          (7, 'orange'))

from petl import transpose, look    
Esempio n. 2
0

# rangefacet

table1 = [['foo', 'bar'],
          ['a', 3],
          ['a', 7],
          ['b', 2],
          ['b', 1],
          ['b', 9],
          ['c', 4],
          ['d', 3]]

from petl import rangefacet, look
look(table1)
rf = rangefacet(table1, 'bar', 2)
rf.keys()
look(rf[(1, 3)])
look(rf[(7, 9)])


# transpose

table1 = (('id', 'colour'),
          (1, 'blue'),
          (2, 'red'),
          (3, 'purple'),
          (5, 'yellow'),
          (7, 'orange'))

from petl import transpose, look