Auto-group
The lowest-friction path: hand the grid a flat frame and nothing else. With auto-group on, schema
inference picks the row hierarchy — the non-numeric columns, ordered by ascending cardinality so
the coarsest dimension nests outermost — and turns every numeric column into a summed measure. It is
a starting point, not a straitjacket: any explicit rows / measures you pass always win.
from dash_tensor_grid import TensorGrid, build_grid
# No rows / measures — the engine infers both from the data.payload = build_grid(sales, { "auto_group": True, "formats": {"revenue": "currency:USD", "cost": "currency:USD"},})TensorGrid(id="grid", row_data=payload["row_data"], column_defs=payload["column_defs"])<TensorGrid data={data} autoGroup formats={{ revenue: '$0,0', cost: '$0,0' }}/>;<TensorGrid :data="data" auto-group :formats="{ revenue: '$0,0', cost: '$0,0' }"/>mountTensorGrid(el, { data, autoGroup: true, formats: { revenue: '$0,0', cost: '$0,0' },});- Dimensions by ascending cardinality. Columns with fewer distinct values group first, so a
region → country → city-shaped frame nests in that order without you naming it. - Numeric columns become
summeasures by default. Pass an explicitmeasuresmap to change an aggregation or drop a numeric column from the roll-up — your map takes precedence over inference. - Cap the depth. Dash accepts
max_levels(engine.infer_schema) to limit how many dimension levels are derived; omit it for the engine default. - Explicit always wins. Provide
rowsand auto-group only fills in themeasures, or vice versa — inference runs only for the axis you left empty. - Once you know the shape, prefer spelling out aggregation rows/measures for a stable, reviewable config.