Icon

07_​Python_​Script_​example

Python Script example with new Python API backend

This workflow uses the new Python Script node. This node features a new backend that makes execution of Python scripts as fast in KNIME as it is anywhere else.

Random data is generated by using the Data Generator node and a flow variable is created via the Variable Creator node. The flow variable and the generated data are injected to the Python Script node.

Open the configuration dialog of the Python Script node to write the Python code.

Here a function is applied to the column of the input data table indicated by the flow variable. The transformed data table is available at the output port of the Python Script node.

This workflow is configured to run with the Columnar backend.

URL: KNIME Workbench Guide - Columnar backend https://docs.knime.com/latest/analytics_platform_workbench_guide/index.html#table-backend
URL: KNIME Python Integration Guide https://docs.knime.com/latest/python_installation_guide/index.html#python-script-labs

Python Script example with new Python API backendIn this workflow the new Python Script node is used. The Python script transforms one column of theinput data table, determined by a flow variable, by applying a pow function to it. It writes the result inthe output table. create random datacreate a flow variableIn: random data, flow variable Python script: Apply function to columnOut: processeddata table Data Generator Variable Creator Python Script(Labs) Python Script example with new Python API backendIn this workflow the new Python Script node is used. The Python script transforms one column of theinput data table, determined by a flow variable, by applying a pow function to it. It writes the result inthe output table. create random datacreate a flow variableIn: random data, flow variable Python script: Apply function to columnOut: processeddata tableData Generator Variable Creator Python Script(Labs)

Nodes

Extensions

Links