예제 #1
0
def test_facetcolumns():

    table = [['foo', 'bar', 'baz'], ['a', 1, True], ['b', 2, True], ['b', 3]]

    fc = facetcolumns(table, 'foo')
    eq_(['a'], fc['a']['foo'])
    eq_([1], fc['a']['bar'])
    eq_([True], fc['a']['baz'])
    eq_(['b', 'b'], fc['b']['foo'])
    eq_([2, 3], fc['b']['bar'])
    eq_([True, None], fc['b']['baz'])
예제 #2
0
파일: test_util.py 프로젝트: talwai/petl
def test_facetcolumns():

    table = [["foo", "bar", "baz"], ["a", 1, True], ["b", 2, True], ["b", 3]]

    fc = facetcolumns(table, "foo")
    eq_(["a"], fc["a"]["foo"])
    eq_([1], fc["a"]["bar"])
    eq_([True], fc["a"]["baz"])
    eq_(["b", "b"], fc["b"]["foo"])
    eq_([2, 3], fc["b"]["bar"])
    eq_([True, None], fc["b"]["baz"])
예제 #3
0
파일: test_util.py 프로젝트: obsoleter/petl
def test_facetcolumns():
    
    table = [['foo', 'bar', 'baz'], 
             ['a', 1, True], 
             ['b', 2, True], 
             ['b', 3]]
    
    fc = facetcolumns(table, 'foo')
    eq_(['a'], fc['a']['foo'])
    eq_([1], fc['a']['bar'])
    eq_([True], fc['a']['baz'])
    eq_(['b', 'b'], fc['b']['foo'])
    eq_([2, 3], fc['b']['bar'])
    eq_([True, None], fc['b']['baz'])
예제 #4
0
파일: examples.py 프로젝트: datamade/petl
"""
Examples used in docstrings.

"""

# facetcolumns

from petl import facetcolumns
table = [['foo', 'bar', 'baz'], 
         ['a', 1, True], 
         ['b', 2, True], 
         ['b', 3]]
fc = facetcolumns(table, 'foo')
fc['a']
fc['a']['foo']
fc['a']['bar']
fc['a']['baz']
fc['b']
fc['b']['foo']
fc['b']['bar']
fc['b']['baz']
fc['c']


# rename

table1 = [['sex', 'age'],
        ['m', 12],
        ['f', 34],
        ['-', 56]]
예제 #5
0
파일: examples.py 프로젝트: aklimchak/petl
"""
Examples used in docstrings.

"""

# facetcolumns

from petl import facetcolumns
table = [['foo', 'bar', 'baz'], 
         ['a', 1, True], 
         ['b', 2, True], 
         ['b', 3]]
fc = facetcolumns(table, 'foo')
fc['a']
fc['a']['foo']
fc['a']['bar']
fc['a']['baz']
fc['b']
fc['b']['foo']
fc['b']['bar']
fc['b']['baz']
fc['c']


# rename

table1 = [['sex', 'age'],
        ['m', 12],
        ['f', 34],
        ['-', 56]]
예제 #6
0
from __future__ import division, print_function, absolute_import

# columns()
###########

import petl as etl
table = [['foo', 'bar'], ['a', 1], ['b', 2], ['b', 3]]
cols = etl.columns(table)
cols['foo']
cols['bar']

# facetcolumns()
################

import petl as etl
table = [['foo', 'bar', 'baz'], ['a', 1, True], ['b', 2, True], ['b', 3]]
fc = etl.facetcolumns(table, 'foo')
fc['a']
fc['b']
예제 #7
0
파일: materialise.py 프로젝트: DeanWay/petl
from __future__ import division, print_function, absolute_import


# columns()
###########

import petl as etl
table = [['foo', 'bar'], ['a', 1], ['b', 2], ['b', 3]]
cols = etl.columns(table)
cols['foo']
cols['bar']


# facetcolumns()
################

import petl as etl
table = [['foo', 'bar', 'baz'],
         ['a', 1, True],
         ['b', 2, True],
         ['b', 3]]
fc = etl.facetcolumns(table, 'foo')
fc['a']
fc['b']