Icon

01_​Input_​Data_​Tables

Input Data Tables with Python Script

This workflow shows how to read a KNIME table into a Python Script node using the Pandas or PyArrow libraries. After reading the file as a Pandas DataFrame or a PyArrow Table, we can use Python to execute various operations on the data.

1 input table 2 input tables Reading KNIME Table using Pandas 1 input table 2 input tables Reading KNIME Table using PyArrow 1) 1 input table with PyArrow- The input table is passed to the Python Script nodeas knio.input_tables[0] - The input table is converted to a PyArrow Tablewith .to_pyarrow() method2) 2 input tables with PyArrow- Similar to above example, but with an additionalinput port- Add the second input port to the Python Script nodeby clicking on the three dots- The second input table is passed on asknio.input_tables[1] 1) 1 input table with Pandas- The input table is passed to the Python Script nodeas knio.input_tables[0]- The input table is converted to a Pandas data framewith .to_pandas() method2) 2 input tables with Pandas- Similar to above example, but with an additionalinput port- Add the second input port to the Python Script nodeby clicking on the three dots- The second input table is passed on asknio.input_tables[1] Adopting Python Bundled Packages : Download and open this workflow to auto-install requirements and execute the Python scripts. This workflow uses a node from KNIMEPython Integration, which installs Python and a number of pre-defined packages on your system. Supported on KNIME Analytics Platform4.7 or higher. Iris data set1 input tableIris data setColumn names2 input tablesIris data set1 input tableIris data setColumn names2 input tables CSV Reader Python Script CSV Reader CSV Reader Python Script CSV Reader Python Script CSV Reader CSV Reader Python Script 1 input table 2 input tables Reading KNIME Table using Pandas 1 input table 2 input tables Reading KNIME Table using PyArrow 1) 1 input table with PyArrow- The input table is passed to the Python Script nodeas knio.input_tables[0] - The input table is converted to a PyArrow Tablewith .to_pyarrow() method2) 2 input tables with PyArrow- Similar to above example, but with an additionalinput port- Add the second input port to the Python Script nodeby clicking on the three dots- The second input table is passed on asknio.input_tables[1] 1) 1 input table with Pandas- The input table is passed to the Python Script nodeas knio.input_tables[0]- The input table is converted to a Pandas data framewith .to_pandas() method2) 2 input tables with Pandas- Similar to above example, but with an additionalinput port- Add the second input port to the Python Script nodeby clicking on the three dots- The second input table is passed on asknio.input_tables[1] Adopting Python Bundled Packages : Download and open this workflow to auto-install requirements and execute the Python scripts. This workflow uses a node from KNIMEPython Integration, which installs Python and a number of pre-defined packages on your system. Supported on KNIME Analytics Platform4.7 or higher. Iris data set1 input tableIris data setColumn names2 input tablesIris data set1 input tableIris data setColumn names2 input tables CSV Reader Python Script CSV Reader CSV Reader Python Script CSV Reader Python Script CSV Reader CSV Reader Python Script

Nodes

Extensions

Links