Skip to content
Alistair Miles edited this page Feb 5, 2014 · 1 revision

Create an empty table

To be a valid table, at least an empty header row is required. E.g.:

>>> import petl.interactive as etl
>>> tbl = (etl
...     .wrap([[]])
...     .addcolumn('foo', ['a', 'b', 'c'])
...     .addcolumn('bar', [1, 2])
... )
>>> tbl
+-------+-------+
| 'foo' | 'bar' |
+=======+=======+
| 'a'   |     1 |
+-------+-------+
| 'b'   |     2 |
+-------+-------+
| 'c'   | None  |
+-------+-------+
Clone this wiki locally