import knime.scripting.io problem

Hi, sorry for the dumb question but i couldn’t get node to work.
This is the code that used to work with import knime_io as knio now i see it’s deprecated i did a lot of tests but i can’t get it to work.
Can you help me ?

OLD
import knime_io as knio
import numpy as np
import pandas as pd
df= knio.input_tables[0].to_pandas()
df1= knio.input_tables[1].to_pandas()
df2= knio.input_tables[2].to_pandas()
df3= knio.input_tables[3].to_pandas()
df4= knio.input_tables[4].to_pandas()
df5= knio.input_tables[5].to_pandas()

output_table = df
output_table2 = df_red
output_table3 = df_black

knio.output_tables[0] = knio.write_table(output_table)
knio.output_tables[1] = knio.write_table(output_table2)
knio.output_tables[2] = knio.write_table(output_table3)

NEW
import knime.scripting.io as knio

???

Solved:
import knime.scripting.io as knio
import pandas as pd
import numpy as np

df = knio.input_tables[0].to_pandas()
df1 = knio.input_tables[1].to_pandas()
df2= knio.input_tables[2].to_pandas()
df3= knio.input_tables[3].to_pandas()
df4= knio.input_tables[4].to_pandas()
df5= knio.input_tables[5].to_pandas()

knio.output_tables[0] = knio.Table.from_pandas(df)
knio.output_tables[1] = knio.Table.from_pandas(df_red)
knio.output_tables[2] = knio.Table.from_pandas(df_black)

2 Likes

Thanks for posting (and marking) the solution you found!

1 Like

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