Knime Python extension schema for new pandas dataframe

Hi,

im trying to create new dataframe in node, but im getting schema error - i beleive it is due to RowID appearing after pandas dataframe is handed back to knime - how do i declare it in schema? It seems to be typeless - i have tried using String with no luck…

    def configure(self, configure_context):
        """Defines the output schema (no inputs in this node)."""
        output_schema = knext.Schema.from_columns([
            knext.Column(knext.int32(), "A"),
            knext.Column(knext.int32(), "B"),
        ])
        return output_schema

    def execute(self, exec_context):
        """Generates a small pandas DataFrame as output."""
        data = pd.DataFrame({
            "A": [1, 2, 3],
            "B": [10, 20, 30],
        })
        return knext.Table.from_pandas(data)

Nevermind - restarted everything a few times and it works…

1 Like

Glad it worked out in the end!

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