Convert dataframe/table to array and vice versa

Hi

I'm a beginner in KNIME and would like use „normal“ python code (not the special panda syntax) in the “python script” node to modify single array entries. For example the normal source code does not lead to results:

 

array = input_table.copy()

array[1,2] = array[1,2]+ 1

output_table = array

 

KNIME provides the input table as data frame in the “python script” node and also expects a data frame table as output.

Is it possible to convert the “dataframe” input table into an array to use normal python code and after my array modification back into a “dataframe” output table?

 

Best regards

Fabian

Hi Fabian,

Personally I'd recommend spending a bit of time getting to know Pandas dataframes. They are really powerful for data manipulations. Although admittedly it does take a bit of time to get used to them.

In case you really don't want to use dataframe, then I think that the following Stack Overflow page is probably helpful.

Best,

Jon