Python Script Table Output

Howdy Knimers,

Im working with the Python Script node and although my code runs and the configuration view of the node shows the right output, I am missing the table output to see it and be able to work with further nodes in KNIME.

The error is “knime user error: output table ‘0’ must be of type knime.api.Table or knime.api.batch output Table but got class ‘list’”

This is my code

import as knio

This example script simply outputs the node’s input table.

knio.output_tables[0] = knio.input_tables[0]

numbers = knio.flow_variables[‘Sorted list*(Folio_Import)’]

lowest = min(numbers)
biggest = max(numbers)


number_range = range(lowest, biggest+1)

This is how my output looks inside the configuration screen

This is how it errors out from the node itself

Any help is truly appreciated.

@mcrisnidh welcome to the knime forum.

You will have to convert your list to a Pandas dataframe.

Something like this

df = pd.DataFrame(list)
knio.output_tables[0] = knio.Table.from_pandas(df)


df = pd.DataFrame(list)
knio.output_tables[0] = knio.write_table(df)


Thank you for the information. This worked perfectly.


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