python script node pandas dataframe

Hi,

I have a python script node where the program assigns value to the empty columns 3 and 4. Attached is the image and also attached the workflow.

If I do the same code in jupyter notebook, the updated dataframe shows the results where the last two columns are updated.

Please let me know what I am missing.

I essentially would like to know if I can use this approach to update more than 2 columns in a pandas dataframe at the same time.

python script node.knwf (20.5 KB)

Thanks.

I used the following code:

import pandas as pd

df1 = pd.DataFrame(
	data=input_table
	)

for index, row in df1.iterrows():
    print(index)
    df1 = df1.assign(grouped_date = 1)
    df1 = df1.assign(grouped_opp = 2)

print(df1)

output_table = df1

Please verify the results.

— Robert

1 Like