kmeans_cluster
Groups rows into clusters based on numeric columns, standardizing features automatically and storing the cluster assignment as a new column for segmentation or pattern discovery.
Instructions
K-Means clustering. Assigns each row to one of n_clusters groups based on numeric columns. Features are auto-standardized before clustering. Result is stored as a new column. Use for customer segmentation, anomaly grouping, or discovering natural data groups. Example: kmeans_cluster(columns=["Revenue","ChargeableWeight","Pieces"], n_clusters=4)
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": {
"columns": "<columns>"
},
"name": "kmeans_cluster"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| columns | Yes | ||
| df_name | No | ||
| n_clusters | No | ||
| random_state | No | ||
| cluster_column | No | cluster |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |