Skip to content

Commit

Permalink
Merge 66f0716 into e9b3e87
Browse files Browse the repository at this point in the history
  • Loading branch information
javidy committed Mar 22, 2021
2 parents e9b3e87 + 66f0716 commit 6b23a66
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions petl/transform/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ def convert(table, *args, **kwargs):
+-----+-------+--------------------+
| 'C' | '1.2' | 67.2 |
+-----+-------+--------------------+
>>> # conversion can use a custom function
>>> def my_func(val, row):
... return float(row.bar) + row.baz
...
>>> table13 = etl.convert(table1, 'foo', my_func, pass_row=True)
>>> table13
+------+-------+-----+
| foo | bar | baz |
+======+=======+=====+
| 14.4 | '2.4' | 12 |
+------+-------+-----+
| 39.7 | '5.7' | 34 |
+------+-------+-----+
| 57.2 | '1.2' | 56 |
+------+-------+-----+
Note that either field names or indexes can be given.
Expand Down

0 comments on commit 6b23a66

Please sign in to comment.