コード例 #1
0
ファイル: test_util.py プロジェクト: pombredanne/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'])
コード例 #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
ファイル: materialise.py プロジェクト: trb116/pythonanalyzer
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']