Python script node getting wring values for empty string

Hello
I have a CSV file, with some empty values for a String column.
I want to read the file, and process it using Python Script node.
The DataFrame object, which is the input for the Python Script, contains “None” values for the empty string values.
If I do the same thing using Pandas “read_csv” function, the values for empty string will be “NaN”
Is there a way to make my code in KNIME be consistent with Pandas, and have NaN values placed in the DataFrame, isntead of None?

I am attaching here a simple example, which shows the differences between Pandas and KNIME behavior.

None_example.zip (8.4 KB)

Hello,

Thank you for your question. In KNIME, NaN (Not-A-Number) is used when dealing with numbers, that makes it harder to convert if you have a columns of Strings with missing values. Would it be an option to convert NaN to missing values instead?
This question has been addressed in the forum:

Hope that helps,
Jeany

Thanks for the response Jeany.
I understand the reason, but I was looking for compatibility with Pandas, just to be able to move Python code back and forth between KNIME and my Notebooks.

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