Sandbox — LSD is in active testing. All systems operational·payments are test-mode (no real charges).
Overview Use Cases News Docs Tool Store Support Community Get LSD
All docs
Docs/ API Reference/ Table/ group_by
Table· method

Table.group_by

groups by one or more columns; chain .agg to reduce

Python
group_by(*keys: str) -> GroupBy

Returns GroupBy — an intermediate; call .agg(col=func, ...) to reduce

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 · null_report · sort

Guides: Tables & data flow

By LSD Team · Last updated Jul 17, 2026 Ask on Discord View as Markdown