Error in Python Predictor Node

Hi, I’m currently learning to connect Python to KNIME. However, when trying to connect to Python predictor node, I found error as per below:

ValueError: Found array with 0 sample(s) (shape=(0, 6)) while a minimum of 1 is required.

Is there anything wrong in previous node?
here is the sample data and my workflow

KNIME_Titanic.knwf (13.0 KB)
test.xlsx (38.4 KB)
train.xlsx (73.2 KB)

Hi @andersenyunan,

the problem is that you try to map strings in the Sex columns to integers, while this column is already an integer. So the column after such mapping is filled with np.nan. This leads to all rows being filtered out, when you do df.dropna() in the predictor node.

Cheers,
Misha

3 Likes

I see that’s where I was wrong. Thanks for the solution! :+1:

1 Like

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