示例#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
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 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
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']