py_run
Run Python code to transform, aggregate, or generate charts from data frames, with variables and imports persisting between calls. Pass frame handles to recover data after kernel timeouts.
Instructions
EXECUTES Python in the session kernel — pandas, numpy, scipy, matplotlib (Agg), plotly, altair are importable; DATA holds loaded frames; variables and imports survive to your next call. Use it to transform/aggregate before charting, or run a python recipe (matplotlib figures: savefig to an absolute path in the artifact scratch). Resource-capped (memory rlimit + your wall_s, max 570s).
Pass frame_handles as {name: handle} to put stored frames back in
DATA before the code runs — this is how you RECOVER after a timeout
killed the kernel, and how any call gets a frame it did not load
itself. Returns frame_handles for every frame in DATA afterwards,
re-addressed if your code changed them, so the next call always has
a durable name for the work this one did. You get them back even
when the code raises. stdout/stderr come back bounded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| wall_s | No | ||
| frame_handles | No |