Slow Python Node execution

Hi there,

I’m using python nodes quite a lot in my Workflows and sometimes even in loop constructions. I’m wondering why the execution of a python node takes so long even when only a few number crunching is done. For me it seems that the initialisation of the python environment behind it takes the most of the execution time.

For example:

# KNIME settings
import knime.scripting.io as knio
df = knio.input_tables[0].to_pandas()
# END of KNIME settings
# The usual suspects
import pandas as pd
import numpy as np
# core script
df = df.groupby('a').sum('c')
df['d'] = np.sqrt(df['c']) + 23
# Postptrocessing
df1 = df.copy()
# KNIME Postprocessing Settings
knio.output_tables[0] = knio.Table.from_pandas(df1)
# KNIME Postprocessing Settings

Takes about 4 seconds when it’s filled with a table of 35 rows and 3 columns (string + 2 number columns).