# Table.group_by
URL: https://lsd.tools/docs/api-table-group-by
Updated: 2026-07-17

## Parameters

| name | type | default | description |
|---|---|---|---|
| `*keys` | `str` | — | one or more columns to group by (a single list or tuple also works) |

## Example

```python
t.group_by("team").agg(score="mean", n="count")
# → one row per team with mean score + row count
```

## Notes

`group_by` returns an intermediate — call `.agg(**aggs)` on it, where each value is a
pyarrow function name (`"mean"`, `"sum"`, `"count"`, `"min"`, `"max"`, …). The result keeps
the grouping keys plus one column per aggregation, **named after the original column**
(`score` stays `score`, not `score_mean`). A single list or tuple of keys is accepted.

## See also

**API:** [join](/docs/api-table-join) · [null_report](/docs/api-table-null-report) · [sort](/docs/api-table-sort)

**Guides:** [Tables & data flow](/docs/tools-tables)
