Skip to content

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:

  1. Call df.groupBy(["colName"]) to create a GroupedDataFrame.
  2. 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

  • AggFn type — (values: Cell[]) => Cell for user-supplied aggregation functions
  • GroupedDataFrame class with count(), first(), last(), and agg() methods
  • DataFrame.groupBy(keys: string[]): GroupedDataFrame method

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:
    • 03e1388 feat(torch): add GroupedDataFrame class and AggFn type to frame.ts
    • 5a43413 feat(torch): add DataFrame.groupBy() method
    • c31837e perf(torch): optimize groupBy to accumulate rows in buckets before conversion
    • 111c90b test(torch): add groupBy / GroupedDataFrame tests to frame.test.ts
    • 44c2167 docs(torch): update docstrings for GroupedDataFrame and DataFrame.groupBy

Known Issues

  • None

Next Steps

  • LazyDataFrame の追加(遅延評価フレームワーク)