File: fills.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 (53 lines) | stat: -rw-r--r-- 1,122 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from __future__ import division, print_function, absolute_import


# filldown()
############

import petl as etl
table1 = [['foo', 'bar', 'baz'],
          [1, 'a', None],
          [1, None, .23],
          [1, 'b', None],
          [2, None, None],
          [2, None, .56],
          [2, 'c', None],
          [None, 'c', .72]]
table2 = etl.filldown(table1)
table2.lookall()
table3 = etl.filldown(table1, 'bar')
table3.lookall()
table4 = etl.filldown(table1, 'bar', 'baz')
table4.lookall()


# fillright()
#############

import petl as etl
table1 = [['foo', 'bar', 'baz'],
          [1, 'a', None],
          [1, None, .23],
          [1, 'b', None],
          [2, None, None],
          [2, None, .56],
          [2, 'c', None],
          [None, 'c', .72]]
table2 = etl.fillright(table1)
table2.lookall()


# fillleft()
############

import petl as etl
table1 = [['foo', 'bar', 'baz'],
          [1, 'a', None],
          [1, None, .23],
          [1, 'b', None],
          [2, None, None],
          [2, None, .56],
          [2, 'c', None],
          [None, 'c', .72]]
table2 = etl.fillleft(table1)
table2.lookall()