Skip to content

Execute python script

Description

The Execute python script activity enables you to run custom Python code on your structured data within the workflow. This activity is ideal for advanced transformations, modeling, calculations, or applying external Python libraries not natively supported by the platform.

  • Your code must use a df DataFrame as the input, which is automatically injected from the input data.
  • The final result must be a modified df, which will be returned as tabular data.
  • Output must be printed using print(result_json) as a JSON string.

Use case: You can apply advanced statistical transformations, encode text, or apply models using libraries like pandas, scikit-learn, or numpy within a workflow step using this activity.

Input

  • Data – Required
    Tabular data passed as a DataFrame (df) into the script.

Output

Output TypeFormatDescription
DataTabularOutput of the modified df DataFrame

Configuration Fields

Field NameDescription
CodePython code to run. Input data is provided as a DataFrame named df. Required field.

Sample Input

ItemScore
Pen3.5
Book4.7
Chair2.9

Sample Configuration

df['Score'] = df['Score'] * 10
df['Category'] = df['Score'].apply(lambda x: 'High' if x > 30 else 'Low')

Sample Output

ItemScoreCategory
Pen35.0High
Book47.0High
Chair29.0Low