knime-mpicbg / knime-scripting

knime-scripting includes scripting extensions for KNIME to integrate R, Matlab, Python and Groovy scripts. These extensions include a collection of nodes to develop and deploy templates in the respective languages.
https://github.com/knime-mpicbg/knime-scripting/wiki
Other
43 stars 25 forks source link

Python Scripting templates do not return pandas Dataframe #116

Open bicklem opened 6 months ago

bicklem commented 6 months ago

I am creating Python Scripting snippets for image analysis, but the pyOut DataFrame throws an error when converting to csv ERROR Python Snippet 4:520 Execute failed: Error in processing: Traceback (most recent call last): File "/private/var/folders/52/2b38vy8j1nl56kcrn426xzrm0000gn/T/SVmMQ4_analyze_3818067234225383873.py", line 148, in write_csv(r"/private/var/folders/52/2b38vy8j1nl56kcrn426xzrm0000gn/T/SVmMQ4_pyOut_python2knime_11741287442358462654.csv",pyOut) File "/private/var/folders/52/2b38vy8j1nl56kcrn426xzrm0000gn/T/SVmMQ4_analyze_3818067234225383873.py", line 79, in write_csv pyOut.to_csv(f, header=False, date_format='%Y-%m-%dT%H:%M:%S.%f', line_terminator = '\r\n', escapechar = "\", doublequote=False, quoting=csv.QUOTE_NONNUMERIC) TypeError: to_csv() got an unexpected keyword argument 'line_terminator'

Looking at the Traceback the keyword for line terminator should 'lineterminator'

Thanks

KNIME version: 4.7.7 Python: 3.9.18 Computer: MacBook Pro, M1 Max, 64GB RAM OS: Ventura 13.5.1

niederle commented 6 months ago

Thank you for pointing that out. Indeed, the argument 'line_terminator' changed to 'lineterminator' with pandas <=1.4 to pandas >= 2.0 I can confirm that the node works with pandas (1.4.4) using python 3.8 (which also work with python 3.9).

bicklem commented 6 months ago

Thank you for posting your pandas version, I could create an environment with all requested packages. The first scripts work now and return the tables just fine.

niederle commented 6 months ago

I will keep the issue open to take care of it as soon as there are capacities. The node should not depend too much on python package versions.