Hi @AJA,
I’ve looked at this further, and the “key error” that you are getting is expected from the “at” function on a dataframe if a label that you have supplied is not known.
The reason you are seeing this is because of the value 1
in your .at[1,"column1"]
statement
Ordinarily, when using pandas, when you create a dataframe from a list, or csv file, for example, the “index” for the dataframe will simply be an integer which effectively acts as a row number which I believe is what you were expecting.
However, in KNIME, it creates an index column containing the “row label” which is not an integer, but is instead a label “Row0”, “Row1”. This can then act as a unique row identifier regardless of future actions such as sorting, joining and filtering.
To demonstrate what I mean, take the following following input table:

In a python script, if you were to print input_table_1 in the Python Script node, you would see it looks like this:
This means that the first parameter for the at function will be one of the row labels “Row0”, “Row1” and so on, whilst the second parameter would be the column label “column1”
e.g.
If you want to return the cell for a named column, using a row number (starting at row 0), the following methods could be used
# Copy input to output
output_table_1 = input_table_1.copy()
print(input_table_1)
print("-- returning specific cell value:")
print("Using at:"+input_table_1.at["Row1","column1"])
# To return a given cell by row number and column name, you can use one
# of the following methods:
print("Using iLoc#1:"+input_table_1.iloc[1,input_table_1.columns.get_loc("column1")])
print("Using iLoc#2:"+input_table_1['column1'].iloc[1])
I’ve uploaded the above example here:
python cell value in dataframe.knwf (8.0 KB)
edit: if you really want to use “at”
, then the following would also work:
print("Using at and row number:"+input_table_1.at[input_table_1.index[1],'column1'])