Python Script Node: DataFrame constructor not properly called

Hello everyone,

I’m facing a problem with Python Script node that I’ve never encountered before while creating dataframes.
I’m trying to convert the input table to Pandas dataframe as shown below:


However, i keep getting “DataFrame constructor not properly called” error. Although, creating a dataframe this way was working fine with me.

I’m using KNIME 4.7.2 and Python 3.8

Your help is truly appreciated!

Hi
You can’t create a dataframe like this from the input table.
It should rather look like

df = knio.input_tables[0].to_pandas()
knio.output_tables[0] = knio.Table.from_pandas(df)

br

3 Likes

If you are working with KNIME Analytics Platform and using its Python integration, the correct way to create a Pandas DataFrame from an input table and then assign it back as an output table is indeed as you described:

  1. Convert the first input table to a Pandas DataFrame:
df = knio.input_tables[0].to_pandas()
  1. After processing your DataFrame, convert it back to a KNIME table and assign it to an output slot:
knio.output_tables[0] = knio.Table.from_pandas(df)

This approach uses KNIME’s Python integration (knio) to interchange data between KNIME and Pandas, which is efficient for data processing within KNIME workflows using Python.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.