Column filter widget with Python script.

Hello, I have this question. I created node Excel reader, then column filter widger, to select columns I want. As far as I understand, they should pass to the node Python script as an array. But I don’t know how I can assign this array to a variable, for example, to perform the necessary actions.

Hello @mak_782
You can learn in the node by looking at the examples in ‘Templates’ tab.

Besides that, take a look in the following code as starting point

import knime.scripting.io as knio
import pandas as pd

# data in
df = knio.input_tables[0].to_pandas()

# things happen
print(df)

# output as pd.DataFrame
knio.output_tables[0] = knio.Table.from_pandas(df)


You can add more input and output ports if the case.

BR

2 Likes

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