Conversion to missing values: Python

Hello,

I’m sorry if this has been asked before, but I wasn’t able to find an appropriate answer to this topic.

Which value can I use in Python in order to have a missing value in KNIME? The columns I’m looking at consist of doubles.
I tried every kind of NaN within Python out.

Using “None” or the sentinel value option of the Python node configuration seems only to work for strings.

Thank you!

Hi RandomForest,

As far as I know, pandas always uses NaN to encode numerical missing values, even if you explicitly use None (see https://pandas.pydata.org/pandas-docs/stable/missing_data.html#inserting-missing-data). Those are then mapped to NaNs on KNIME side because KNIME does distinguish between NaNs and missing values. (I.e., NaNs are considered to be valid values.) Sentinel options are only available for integer values, unfortunately.
If you don’t need to distinguish between both, I’d suggest to convert all NaNs to missing values after the Python node.

Marcel

4 Likes

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