Python script node

Hi KNIMEers,

DataFrame.append() is throwing up error when i run the code in python script node. However, i get no errors when the same code is run on Jupyter Notebook. All, i am trying to do is take a table as df (input_table) and make a copy of it and remove all data retaining the column headers (resulting=another df). Then append rows from the input_table onto the second df one by one. It is important that i append each row of input_table individually.

When i try to do this, this is the error i get:
TypeError: cannot do label indexing on <class ‘pandas.core.indexes.base.Index’> with these indexers [0] of <class ‘int’>

Extract of code:
input_table=input_table.fillna(0)
input_table_2=input_table.copy()
input_table_2=input_table_2[0:0]

for i in range(0,len(input_table.index)):
input_table_2=input_table_2.append(input_table.loc[i],ignore_index=True)

Thanks and Regards
Deepan

Can you upload your workflow with example data?

2 Likes

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