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 Type
Format
Description
Data
Tabular
Output of the modified df DataFrame
Configuration Fields
Field Name
Description
Code
Python code to run. Input data is provided as a DataFrame named df. Required field.
Sample Input
Item
Score
Pen
3.5
Book
4.7
Chair
2.9
Sample Configuration
df['Score'] = df['Score'] *10
df['Category'] = df['Score'].apply(lambdax: 'High'if x >30else'Low')