Error in KNIME with Python Integration

Dear all

Need your kindly help again!

*********************************************************************

I have bought a new notebook so as to improve the analysis speed.  However, a nightmare appeared.

 

The problem appeared in Python node (Python Source).  After I install the latest KNIME (3.4.1), then upgraded to 3.5 and perform setup for Python (either 2.7.14 or 3.6) using Anaconda.  The integration is successful.

However, when I import the python node which created from my old notebook (using KNIME 3.4.1 and Python 2.7.13), and run the Python node, the errors appeared as follows:

 

Traceback (most recent call last):
  File "C:\Program Files\KNIME\plugins\org.knime.python_3.4.1.v201709070953\py\PythonKernel.py", line 286, in execute
    exec(source_code, _exec_env, _exec_env)
  File "<string>", line 173, in <module>
  File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 2682, in __setattr__
    return object.__setattr__(self, name, value)
  File "pandas\src\properties.pyx", line 65, in pandas.lib.AxisProperty.__set__ (pandas\lib.c:45018)
  File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 425, in _set_axis
    self._data.set_axis(axis, labels)
  File "C:\Python27\lib\site-packages\pandas\core\internals.py", line 2578, in set_axis
    (old_len, new_len))
ValueError: Length mismatch: Expected axis has 0 elements, new values have 2 elements

 

The problem still exist even re-install for Python 2.7.13 and KNIME 3.4.1 or lower version.

 

Can you help to let me know how to resolve it?

 

Thanks
Lawson

 

Hey Lawson,

sorry I do not understand your problem completely. Did you import your 3.4 workflow into KNIME 3.5 ? Does the python node have a "(deprecated)" suffix in the description ? If so please try to replace your node with a new one and copy your python script. 

The error message you get seems to indicate that you want to set values to a pandas object along a non-existing dimension,  but its hard to track down the specific error without seeing the code. Could be the case that you need to initialize  a Dataframe giving a set of column names.

Best

Clemens