Python Snippet

The node executes Python code. There are two ways to configure which code will be executed:

  1. Select (Templates Tab; double-click or "Use this template") and configure a Python template from the template repository.
  2. Write you own Python code (Script Editor Tab)

The Python installation which is used for execution can be set in the Preferences under KNIME > Community Scripting > Python Scripting. The settings allow to switch between a Python2 and Python3 installation. They further provide to set template resources (URLs or file locations) for either plot and snippet respectively.

Further, the node can be executed in an 'Open External' mode (checkbox at the Script Editor Tab) which then would push the KNIME data to Python for troubleshooting or prototyping (either as a Jupyter notebook or via command line).

For detailed information check out the Wiki Page

Options

Templates

Templates/Refresh
Loads again the template file(s).
Templates/Gallery
Generate a temporary webpage shown in a browser which gives an overview about all available templates.
Templates/Description,Source
Description explains what this snippet does. Source displays the RGG script.
Templates/Use this template
Click to load the GUI (or double-click onto the template)

Script Editor

Open external
If checked, Python will be opened externally, either as Jupyter notebook or via command line.
Scipt Editor/Unlink from Template
Gives access to the Python script after adaptation by the GUI.
Scipt Editor/Edit Template
Gives access to the RGG script to adapt the GUI of a template.

Input Ports

Icon
A data table
Provided as pandas data frame named kIn in Python.

Output Ports

Icon
The data table that the Python snippet returns.
Expected as pandas data frame named pyOut in Python

Popular Predecessors

  • CSV Reader4 %
  • Table Creator4 %
  • Joiner4 %
  • Column Filter4 %
  • Variable Loop End4 %
  • Python Snippet3 %
  • Python Snippet 2:23 %
  • Python Source3 %
  • Python Script3 %
  • Python Script3 %
  • Joiner3 %
  • Concatenate3 %
  • Column Resorter3 %
  • Rule Engine3 %
  • Excel Reader3 %
  • Python Source3 %
  • Sorter3 %
  • Excel Writer3 %
  • Conda Environment Propagation3 %
  • Path to String3 %
  • Row Filter2 %
  • Table Manipulator2 %
  • Convert to Table2 %
  • String To Number2 %
  • Column Expressions2 %
  • Path to String (Variable)2 %
  • String Configuration2 %
  • Date&Time Widget2 %
  • Conda Environment Propagation2 %
  • Python Predictor2 %
  • R Snippet2 %
  • Cross Joiner1 %
  • Row Splitter1 %
  • String Manipulation1 %
  • Crosstab (local)1 %
  • Affinity Calculator (HYDE)< 1 %
  • Table Row To Variable Run-to-time Loop Start< 1 %
  • Normalize Plates (POC)< 1 %
  • R Snippet< 1 %
  • Wait...< 1 %
  • Table Row to Variable< 1 %
  • Variable to Table Row< 1 %
  • File Reader< 1 %
  • File Reader< 1 %
  • Java Snippet< 1 %
  • Case Converter< 1 %
  • Column Rename (Regex)< 1 %
  • Constant Value Column< 1 %
  • Pivoting< 1 %
  • RowID< 1 %
  • String Manipulation (Multi Column)< 1 %
  • Rule-based Row Filter< 1 %
  • Strings To Document< 1 %
  • Compare Segments< 1 %
  • Python Edit Variable< 1 %
  • GET Request< 1 %
  • String to Date&Time< 1 %
  • Create Date&Time Range< 1 %

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.