Python code is successful in the config window but fails when the node is executed

Hi,

I ran a python code within a Python Source node and it’s working INSIDE THE config window.
When I go out and run it as a node, it fails with -

ERROR PythonKernel ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
ERROR Python Source 0:98 Execute failed: An exception occured while running the python kernel. See console and log for details.

What could go wrong?
I the same python code before, successfully. I added some calculations & dataframes, and now it has those errors.

Thanks,
Claudette

1 Like

Knime worflow and the txt files to be read from one folder:

KNIME_py_error.knwf (7.1 KB)
W932MQLX_V4AltList.txt (14.7 KB)
WDE7M0XL_V4AltList.txt (328 Bytes)
WES2JDQV_V4AltList.txt (1.3 KB)
WDE00EMK_V4AltList.txt (16.7 KB)

Hey Claudette,

it seems like your script creates an index with ambiguous values. This is not supported in KNIME, but only becomes a problem as soon as the output_table is transferred. Adding the following lines to your script should fix the problem:

output_table['idx'] = range(len(output_table))
output_table.set_index('idx', inplace=True)

I hope my response solves your problem, if you have any further questions, please do not hesitate to reach out to me again.

Best,

Clemens

2 Likes

Thanks Clemens.
It works!

I just wonder why its successful inside the config window but failed when executed as a node.
This makes it difficult to debug.

Regards,
Claudette

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