예제 #1
0
파일: examples.py 프로젝트: datamade/petl
look(table1)
table2 = fillright(table1)
look(table2)

# fillleft
table1 = (('foo', 'bar', 'baz'),
          (1, 'a', None),
          (1, None, .23),
          (1, 'b', None),
          (2, None, None),
          (None, None, .56),
          (2, 'c', None),
          (None, 'c', .72))
from petl import fillleft, look
look(table1)
table2 = fillleft(table1)
look(table2)
    

# multirangeaggregate

table1 = (('x', 'y', 'z'),
      (1, 3, 9),
      (2, 3, 12),
      (4, 2, 17),
      (2, 7, 3),
      (1, 6, 1))

from petl import look, multirangeaggregate
look(table1)
table2 = multirangeaggregate(table1, keys=('x', 'y'), widths=(2, 2), aggregation=sum, mins=(0, 0), maxs=(4, 4), value='z')
예제 #2
0
파일: fills.py 프로젝트: rogerkwoodley/petl
    ["foo", "bar", "baz"],
    [1, "a", None],
    [1, None, 0.23],
    [1, "b", None],
    [2, None, None],
    [2, None, 0.56],
    [2, "c", None],
    [None, "c", 0.72],
]
table2 = etl.fillright(table1)
table2.lookall()


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

import petl as etl

table1 = [
    ["foo", "bar", "baz"],
    [1, "a", None],
    [1, None, 0.23],
    [1, "b", None],
    [2, None, None],
    [2, None, 0.56],
    [2, "c", None],
    [None, "c", 0.72],
]
table2 = etl.fillleft(table1)
table2.lookall()
예제 #3
0
파일: examples.py 프로젝트: aklimchak/petl
look(table1)
table2 = fillright(table1)
look(table2)

# fillleft
table1 = (('foo', 'bar', 'baz'),
          (1, 'a', None),
          (1, None, .23),
          (1, 'b', None),
          (2, None, None),
          (None, None, .56),
          (2, 'c', None),
          (None, 'c', .72))
from petl import fillleft, look
look(table1)
table2 = fillleft(table1)
look(table2)
    

# multirangeaggregate

table1 = (('x', 'y', 'z'),
      (1, 3, 9),
      (2, 3, 12),
      (4, 2, 17),
      (2, 7, 3),
      (1, 6, 1))

from petl import look, multirangeaggregate
look(table1)
table2 = multirangeaggregate(table1, keys=('x', 'y'), widths=(2, 2), aggregation=sum, mins=(0, 0), maxs=(4, 4), value='z')
예제 #4
0
파일: fills.py 프로젝트: zli69/petl
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()