コード例 #1
0
ファイル: test_etl.py プロジェクト: shepardjma/parsons
    def test_chunk(self):

        test_table = Table(petl.randomtable(3, 499, seed=42))
        chunks = test_table.chunk(100)

        # Assert rows of each is 100
        for c in chunks[:3]:
            self.assertEqual(100, c.num_rows)

        # Assert last table is 99
        self.assertEqual(99, chunks[4].num_rows)
コード例 #2
0
from __future__ import division, print_function, absolute_import

# randomtable()
###############

import petl as etl

table = etl.randomtable(3, 100, seed=42)
table

# dummytable()
##############

import petl as etl

table1 = etl.dummytable(100, seed=42)
table1
# customise fields
import random
from functools import partial

fields = [('foo', random.random), ('bar', partial(random.randint, 0, 500)),
          ('baz', partial(random.choice,
                          ['chocolate', 'strawberry', 'vanilla']))]
table2 = etl.dummytable(100, fields=fields, seed=42)
table2
コード例 #3
0
ファイル: random.py プロジェクト: DeanWay/petl
from __future__ import division, print_function, absolute_import


# randomtable()
###############

import petl as etl
table = etl.randomtable(3, 100, seed=42)
table


# dummytable()
##############

import petl as etl
table1 = etl.dummytable(100, seed=42)
table1
# customise fields
import random
from functools import partial
fields = [('foo', random.random),
          ('bar', partial(random.randint, 0, 500)),
          ('baz', partial(random.choice,
                          ['chocolate', 'strawberry', 'vanilla']))]
table2 = etl.dummytable(100, fields=fields, seed=42)
table2