Python Script Node error unsupported operand type(s)

Hi all,

I have an error with Python Script Node

I get this error when i try to run this code in the Python Script Node, can someone help me to fix this error.

Here are the types of my columns

But when i’m trying to run the same code in Series, it’s working.

The same code where I had the problem knime works on Jupyter

Hi @dsyouness,

Could you please share your workflow or the data you are working on? I am not really sure what the problem could be, so reproducing it locally would probably be fastest to see what is going on. Thanks!


Hi @MarcelW thank you for reply, i just create a node KNIME_interpolate.knwf (8.4 KB)

Hi @dsyouness,

The 'nearest' interpolation method you are using requires the DataFrame’s index to be numerical in order to tell which row is nearest to the one being interpolated at a time. In KNIME, however, the index of the DataFrame is of the form Row0, Row1, Row2, etc. (so, string-valued). If you expect the index to be equally spaced, you could simply use the 'linear' interpolation method instead of 'nearest'. If you do require a notion of distance between your rows (for example, because rows in the input have been skipped like so: Row0, Row2, Row3; then Row2 would be closer to Row3), you must first convert the index into a numerical form.

More information about pandas’s interpolate function can also be found here.



Thank you very much @MarcelW , it’s work i just add a line of code :slight_smile:

output_table = output_table.reset_index(drop=True)


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