Python function

This processor executes a custom Python function for each row.

It allows you to easily perform complex computations in a preparation script.

To operate this processor, you write a process(row) Python function.

Operation modes

The processor features 3 modes of operations:

  • ‘cell’: in this mode, you select an output column and the process function must return a single value, which is used as the value of the output column.
  • ‘row’: in this mode, the process function returns a Python dictionary. All columns and values of the input row are replaced by the keys and values of the dictionary.
  • ‘rows’: in this mode, the process function returns an iterable of rows. The input row is deleted and replaced by all rows returned by the function (so you can have 1->N processing).

Help and code

When you select an operation mode, some sample code is automatically written so you only need to write your custom logic.

Restrictions

The Python function is executed by Jython and thus only the standard Python library is available. You may not use custom Python packages. If you require custom Python packages, then you should create a data preparation recipe with all previous steps, and then a Python recipe.