Skip to content

Commit

Permalink
Document behavior of multi-field convert-with-row
Browse files Browse the repository at this point in the history
Fixes #531.
  • Loading branch information
tradlux-chul authored and juarezr committed Dec 24, 2020
1 parent b8068f8 commit 128b930
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions petl/transform/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,25 @@ def convert(table, *args, **kwargs):
arguments to the conversion function (so, i.e., the conversion function
should accept two arguments).
When multiple fields are converted in a single call, the conversions
are independent of each other. Each conversion sees the original row::
>>> # multiple conversions do not affect each other
... table13 = etl.convert(table1, {
... "foo": lambda foo, row: row.bar,
... "bar": lambda bar, row: row.foo,
... }, pass_row=True)
>>> table13
+-------+-----+-----+
| foo | bar | baz |
+=======+=====+=====+
| '2.4' | 'A' | 12 |
+-------+-----+-----+
| '5.7' | 'B' | 34 |
+-------+-----+-----+
| '1.2' | 'C' | 56 |
+-------+-----+-----+
Also accepts `failonerror` and `errorvalue` keyword arguments,
documented under :func:`petl.config.failonerror`
Expand Down

0 comments on commit 128b930

Please sign in to comment.