run_pandas_code
Execute pandas code in a restricted sandbox, optionally preloading a CSV/Excel file, and return the result as structured records.
Instructions
Execute pandas code in a restricted sandbox and return result.
pd (pandas) and np (numpy) are in scope; when file_path is
given, the file is loaded into a DataFrame named df. The code must
assign its output to result. For safety, filesystem/process/interpreter
access (import, open, exec, eval, os/sys/…) is
rejected. DataFrame/Series results are returned as records.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python/pandas code to run. `pd` and `np` are available; assign the final output to a variable named `result`. | |
| file_path | No | Optional CSV/Excel file to preload as a DataFrame named `df` before running the code. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||