"I am running Python code in version 5.1.0 of KNIME and it’s giving an error:
I went to the error log but couldn’t find a message. I ran it in Jupyter Notebook and it’s working fine.
“I ran another code reading another file in KNIME and it worked fine. The file I am trying to read, I noticed that the first column is blank. So, I removed that column in the code. Even then, it continues to give an error.”
Did you look at the KNIME log? Otherwise I think the error should be shown if you click the
Execute script button in the configuration window (see your second screenshot).
I created a separate node just with Python and it works fine without leaking data. I even used another txt and it also worked. If I try to generate a df to be read later, it’s giving this error:
If I remove the ‘output table’, it works correctly."
I don’t see any messages in error Log:
As I said in my previous post, please provide the knime log (I sent a link in the previous post) and not the error log. Furthermore I asked, if you see anything in the scripting windows if you click
Execute script. Please provide these details.
I apologize, I didn’t understand your message. I have never used that log. I was able to access the file and its content was as follows:
I conducted a test with a simple dataframe and it worked. The issue seems to be with the text file that I am reading. I noticed that the message mentions “nan”. I will perform a cleanup on that to see if it resolves the issue.
Your thought with
nan is correct (and you spotted it correctly in the
knime.log). I still don’t understand if you can see that same error also in the scripting window.
Your CSV file has as row ids always
nan. KNIME does not allow that. You could either fix that in the CSV file already or have a look at the detailed documentation: Python Script API — KNIME Python API documentation
There you can see that we can override the given row ides when passing the DataFrame to KNIME. I think, the following could work:
knio.output_tables = knio.Table.from_pandas(df, row_ids="generate")
Does that help?
I noticed that there is a column filled with “nan” values, so I applied a “drop” on the index and it resolved the issue.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.