input_table._get_numeric_data() doesn't work in python predictor. What do I do to fix it?

I am getting such an error in Python Predicator node while running my workflow.


The error is like that:

When I look at the previous node I see there is sampleID. It exists.

But I realized that problem is not about this.

This line in the code doesn’t work:

new_data = input_table._get_numeric_data()

So ._get_numeric_data() doesn’t work in this python code. It shows as Object type.

I am using Mac OS. Do you have any idea about solving the problem?

Hi @aysegulkocak1,

Interesting.
Where does it show as object type?

What is the output of print(input_table['sampleID'])? If I have a column there which comes as an Integer column, I get:

Row0    1.0
Row1    2.0
Row2    3.0
Row3    NaN
Row4    5.0
Name: sampleID, dtype: float64

What is the difference between the output of print(input_table.columns) and the output of print(new_data.columns)?

Which KNIME Analytics Platform are you using?

Best regards
Steffen

1 Like

@aysegulkocak1 could there be a problem with the index of a data frame. Maybe you can reset it.

Hello,

Thank you for your answer.

The output of print(input_table[‘sampleID’]) is :
Screenshot 2023-05-08 at 12.23.50

The difference between the output of print(input_table.columns) and the output of print(new_data.columns):

And I’m using KNIME 4.7.2.
Thanks.

Best,
Ayşegül Koçak

Hi @aysegulkocak1,

thanks for the details. Strange, I cannot reproduce this.

  1. Can you provide your pandas version?

    import sys, pandas
    print(pandas.__version__)
    
  2. Could you try resetting the index as suggested (and explained how to do it) in the post linked above by mlauber?

  3. And, lastly, could you provide a minimal workflow to reproduce this issue?

Best regards
Steffen

2 Likes

Hi,

Thank you so much for your answer again.
The version is 2.0.1.

Actually, I tried resetting the index but it didn’t solve the problem :frowning:

Okay, I will try it with minimal workflow.

Thanks so much.
Best,
Ayşegül Koçak

if possible upload a sample workflow with demo data
br

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