update_column
Modify column values in CSV data using replace, map, fill missing, or apply operations to transform and clean datasets.
Instructions
Update values in a column using various operations with discriminated unions.
Returns: ColumnOperationResult with update details
Examples: # Using discriminated union - Replace operation update_column(ctx, "status", { "type": "replace", "pattern": "N/A", "replacement": "Unknown" })
# Using discriminated union - Map operation
update_column(ctx, "code", {
"type": "map",
"mapping": {"A": "Alpha", "B": "Beta"}
})
# Using discriminated union - Fill operation
update_column(ctx, "score", {
"type": "fillna",
"value": 0
})
# Legacy format still supported
update_column(ctx, "score", {
"operation": "fillna",
"value": 0
})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| column | Yes | Column name to update values in | |
| operation | Yes | Update operation specification (replace, map, apply, fillna) |
Input Schema (JSON Schema)
{
"properties": {
"column": {
"description": "Column name to update values in",
"type": "string"
},
"operation": {
"anyOf": [
{
"discriminator": {
"mapping": {
"apply": "#/$defs/ApplyOperation",
"fillna": "#/$defs/FillNaOperation",
"map": "#/$defs/MapOperation",
"replace": "#/$defs/ReplaceOperation"
},
"propertyName": "type"
},
"oneOf": [
{
"$ref": "#/$defs/ReplaceOperation"
},
{
"$ref": "#/$defs/MapOperation"
},
{
"$ref": "#/$defs/ApplyOperation"
},
{
"$ref": "#/$defs/FillNaOperation"
}
]
},
{
"$ref": "#/$defs/UpdateColumnRequest"
},
{
"additionalProperties": true,
"type": "object"
}
],
"description": "Update operation specification (replace, map, apply, fillna)"
}
},
"required": [
"column",
"operation"
],
"type": "object"
}