In [4]:
import petl.interactive as etl

IPython integration


In [1]:
import petlx.ipython

In [2]:
t1 = etl.dummytable(20).addrownumbers()

In [3]:
t1


Out[3]:
row foo bar baz
1 71 oranges 0.402367477237
2 89 apples 0.417523142787
3 28 bananas 0.0602181133116
4 88 pears 0.561123697131
5 4 oranges 0.764785150353

...


In [4]:
t1.display(caption='test')


test
row foo bar baz
1 71 oranges 0.402367477237
2 89 apples 0.417523142787
3 28 bananas 0.0602181133116
4 88 pears 0.561123697131
5 4 oranges 0.764785150353

...


In [5]:
t1.display(10, caption='test')


test
row foo bar baz
1 71 oranges 0.402367477237
2 89 apples 0.417523142787
3 28 bananas 0.0602181133116
4 88 pears 0.561123697131
5 4 oranges 0.764785150353
6 43 bananas 0.0464294571088
7 22 pears 0.757271408621
8 24 oranges 0.596559652021
9 26 apples 0.477344227436
10 43 bananas 0.0954612611247

...


In [6]:
t1.displayall(caption='test')


test
row foo bar baz
1 71 oranges 0.402367477237
2 89 apples 0.417523142787
3 28 bananas 0.0602181133116
4 88 pears 0.561123697131
5 4 oranges 0.764785150353
6 43 bananas 0.0464294571088
7 22 pears 0.757271408621
8 24 oranges 0.596559652021
9 26 apples 0.477344227436
10 43 bananas 0.0954612611247
11 89 apples 0.0792868818018
12 42 pears 0.529084168277
13 81 apples 0.419182363618
14 98 pears 0.279111830532
15 66 oranges 0.938580433291
16 13 bananas 0.0449622402491
17 81 bananas 0.515076621144
18 66 pears 0.79048251893
19 55 apples 0.0718022948059
20 8 apples 0.698252316855

Numpy integration


In [1]:
import numpy as np

In [5]:
t2 = etl.dummytable(10)

In [8]:
dtype = np.rec.array(tuple(t2.data())).dtype
dtype


Out[8]:
dtype([('f0', '<i8'), ('f1', 'S7'), ('f2', '<f8')])

In [9]:
dtype.names = ['foo', 'bar', 'baz']
dtype


Out[9]:
dtype([('foo', '<i8'), ('bar', 'S7'), ('baz', '<f8')])

In [ ]: