Skip to main content
Glama

change_column_type

Convert column data types in CSV files to improve data analysis, supporting integer, float, string, boolean, and datetime conversions with error handling options.

Instructions

Change the data type of a column.

Returns: ColumnOperationResult with conversion details

Examples: # Convert string numbers to integers change_column_type(ctx, "age", "int")

# Convert to float, replacing errors with NaN change_column_type(ctx, "price", "float", errors="coerce") # Convert to datetime change_column_type(ctx, "date", "datetime") # Convert to boolean change_column_type(ctx, "is_active", "bool")

Input Schema

NameRequiredDescriptionDefault
columnYesColumn name to change data type for
dtypeYesTarget data type (int, float, str, bool, datetime)
errorsNoError handling: 'raise' for errors, 'coerce' to replace invalid values with NaNcoerce

Input Schema (JSON Schema)

{ "properties": { "column": { "description": "Column name to change data type for", "type": "string" }, "dtype": { "description": "Target data type (int, float, str, bool, datetime)", "enum": [ "int", "float", "str", "bool", "datetime" ], "type": "string" }, "errors": { "default": "coerce", "description": "Error handling: 'raise' for errors, 'coerce' to replace invalid values with NaN", "enum": [ "raise", "coerce" ], "type": "string" } }, "required": [ "column", "dtype" ], "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jonpspri/databeak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server