transform_data
Derives a new dataset by applying ordered operations—query, select, drop, rename, fill, sort, sample, reshape, impute—to existing data, then returns a new data handle with recorded lineage.
Instructions
Derive a new dataset from a data_id (or data_path / inline data) by applying operations in order, and return a new data_id with the lineage recorded. Operations (each an object with op): query {expr} (pandas DataFrame.query), select {columns}, drop {columns}, rename {mapping}, dropna {columns?}, fillna {value | mapping}, assign {column, expr} (DataFrame.eval), sort {by, ascending?}, sample {n, seed?}, winsor {columns?, cuts?=[1,99], by?, trim?, method?} (replaces in place), wide_to_long {stubnames, i, j, sep?, suffix?}, long_to_wide {index, columns, values}, mice {columns?, m?} (single completed dataset), function {name, arguments?} (any sp. taking data= and returning a DataFrame). query / assign expressions are limited to columns (backticks for odd names), constants, operators, in / not in, math functions (log, exp, sqrt, abs, ...) and col.isnull()/isin()/between()/str.contains(); other attribute access, subscripts and @locals fail with error_kind='unsafe_expression'.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"operations": "<operations>"
},
"name": "transform_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional label for the new handle. | |
| detail | No | Payload depth; agent is the fullest. | agent |
| data_id | No | Data handle (d_...) from load_data; replaces data_path. | |
| data_csv | No | Small inline table as CSV text. | |
| as_handle | No | Cache the fit and return its result_id. | |
| data_path | No | Absolute path of a data file on the server. | |
| result_id | No | Handle of an earlier fit made with as_handle=true. | |
| operations | Yes | Ordered list of {op, ...} objects. | |
| data_columns | No | Load only these columns. | |
| data_records | No | Small inline table as row objects. | |
| data_sample_n | No | Uniform random subsample of this many rows (seed 0). | |
| max_output_bytes | No | Result byte budget (default 262144; 0 = none). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||