v0.33.0 - GroupedDataFrame (2026-03-22)¶
What Changed?¶
This release adds GroupedDataFrame and DataFrame.groupBy() to the torch module.
Users can now split a DataFrame into groups by one or more key columns and apply
aggregation functions (count, first, last, agg) to each group.
No existing APIs were changed.
What's New¶
Main Feature: DataFrame.groupBy / GroupedDataFrame¶
What it does:
Groups a DataFrame by the unique combinations of one or more key columns and
returns a GroupedDataFrame that supports per-group aggregation.
How to use it:
- Call
df.groupBy(["colName"])to create aGroupedDataFrame. - Call one of the aggregation methods on the result.
Code example:
TypeScript
const df = DataFrame.fromColumns({
dept: ["eng", "eng", "hr"],
score: [80, 90, 70],
});
// row count per group
df.groupBy(["dept"]).count();
// dept | count
// eng | 2
// hr | 1
// first / last row per group
df.groupBy(["dept"]).first();
df.groupBy(["dept"]).last();
// custom aggregation via AggFn
const sum: AggFn = (vals) =>
(vals as number[]).reduce((a, b) => a + b, 0);
df.groupBy(["dept"]).agg({ score: sum });
// dept | score
// eng | 170
// hr | 70
Added¶
AggFntype —(values: Cell[]) => Cellfor user-supplied aggregation functionsGroupedDataFrameclass withcount(),first(),last(), andagg()methodsDataFrame.groupBy(keys: string[]): GroupedDataFramemethod
Changed¶
- Nothing (no existing API was modified)
Fixed¶
- Nothing
Is It Safe to Upgrade?¶
- Breaking Changes: No
- Backward Compatible: Yes
Existing DataFrame code continues to work without changes.
Release Details¶
- Date: 2026-03-22
- Version: v0.33.0
- gaslamp: clasp version 76
- pilotlamp: clasp version 33
- Files Changed: 2 (
src/torch/frame.ts,__tests__/torch/frame.test.ts) - Commits:
03e1388feat(torch): add GroupedDataFrame class and AggFn type to frame.ts5a43413feat(torch): add DataFrame.groupBy() methodc31837eperf(torch): optimize groupBy to accumulate rows in buckets before conversion111c90btest(torch): add groupBy / GroupedDataFrame tests to frame.test.ts44c2167docs(torch): update docstrings for GroupedDataFrame and DataFrame.groupBy
Known Issues¶
- None
Next Steps¶
LazyDataFrameの追加(遅延評価フレームワーク)