File: random.py

package info (click to toggle)
python-petl 1.7.17-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,224 kB
  • sloc: python: 22,617; makefile: 109; xml: 9
file content (26 lines) | stat: -rw-r--r-- 581 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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