File: unpacks.py

package info (click to toggle)
python-petl 1.7.17-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,224 kB
  • sloc: python: 22,617; makefile: 109; xml: 9
file content (25 lines) | stat: -rw-r--r-- 525 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from __future__ import absolute_import, print_function, division


# unpack()
##########

import petl as etl
table1 = [['foo', 'bar'],
          [1, ['a', 'b']],
          [2, ['c', 'd']],
          [3, ['e', 'f']]]
table2 = etl.unpack(table1, 'bar', ['baz', 'quux'])
table2


# unpackdict()
##############

import petl as etl
table1 = [['foo', 'bar'],
          [1, {'baz': 'a', 'quux': 'b'}],
          [2, {'baz': 'c', 'quux': 'd'}],
          [3, {'baz': 'e', 'quux': 'f'}]]
table2 = etl.unpackdict(table1, 'bar')
table2