Python Script (Labs) Error No attribute Loc

Hello, I am trying to run a piece of code in python labs but it keeps throwing me this error

image

Thanks

Hi @Jalvear,
The input tables that are available in the “Python Script (Labs)” node are not pandas DataFrames. Therefore, you can’t call loc on them. This is done for performance reasons because converting data to pandas is slow and we only want to do it if necessary. Just call to_pandas on the input table to convert it to a pandas DataFrame (e.g. input_table_df = knio.input_tables[0].to_pandas()).
We have some examples of how to use the API of the “Python Script (Labs)” node here: KNIME Python Integration Guide. See the example called “Converting input tables to Pandas DataFrames and PyArrow Tables”.
Also, you can find API references here: Contents — KNIME Python Script (Labs) API documentation.

6 Likes

Hi @bwilhelm

thanks for the answer and the explanation with the guide I was able to solve the problems.

3 Likes

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