Skip to content

v0.32.0 - DataFrame Refactoring Foundation (2026-03-22)

What Changed?

This release introduces two new modules as the foundation for a zero-based DataFrame refactoring. convert.ts centralizes conversion logic as pure functions, and frame.ts implements an immutable DataFrame that fully delegates to those conversion functions. No changes were made to the existing dataframe/ module, so backward compatibility is fully preserved.


What's New

Main Feature: convert.ts — Pure Conversion Functions

What it does: Provides 6 pure bidirectional conversion functions and two type aliases (Primitive / Cell) covering three data orientations: column-oriented, row-oriented, and array-oriented. Has no dependency on flamewright or afterglow, and works in both GAS and Node.js environments.

How to use it:

TypeScript
import { columnsToMap, mapToRows, arraysToMap } from "gaslamp";

// Record → Map (column-oriented)
const map = columnsToMap({ name: ["Alice", "Bob"], age: [25, 30] });

// Map → row array (row-oriented)
const rows = mapToRows(map);
rows[0].get("name"); // "Alice"

// 2D array → Map (array-oriented; caller resolves headers)
const data = arraysToMap([["Alice", 25], ["Bob", 30]], ["name", "age"]);

Main Feature: frame.ts — New DataFrame Implementation

What it does: An immutable DataFrame class backed by Map<string, Cell[]>. All conversion logic is delegated to convert.ts — zero duplicate implementation inside the class itself.

How to use it:

TypeScript
import { DataFrame } from "../../src/torch/frame";

const df = DataFrame.fromColumns({ name: ["Alice", "Bob"], age: [25, 30] });

// Method chaining
const result = df
  .filter((row) => (row.get("age") as number) >= 18)
  .withColumn("senior", (row) => (row.get("age") as number) >= 65)
  .rename({ name: "fullName" });

result.headers; // ["fullName", "age", "senior"]
result.shape;   // [2, 3]

Added

  • src/torch/convert.tsPrimitive / Cell type aliases and 6 pure conversion functions
  • columnsToMap / mapToColumns (column-oriented)
  • rowsToMap / mapToRows (row-oriented)
  • arraysToMap / mapToArrays (array-oriented)
  • src/torch/frame.ts — Immutable new DataFrame implementation
  • Input: fromArrays / fromRows / fromColumns / fromMap
  • Transform: select / drop / filter / withColumn / rename
  • Output: toArrays / toRows / toColumns
  • Properties: headers / length / shape
  • __tests__/torch/convert.test.ts — Unit tests for convert.ts (23 cases)
  • __tests__/torch/frame.test.ts — Unit tests for frame.ts (43 cases)

Changed

  • src/torch/index.ts — Added convert.ts to re-exports

Is It Safe to Upgrade?

  • Breaking Changes: No
  • Backward Compatible: Yes

No changes were made to the existing dataframe/ module. frame.ts is not yet re-exported from index.ts due to a name conflict with the existing DataFrame class, so there is zero impact on existing code. The Primitive / Cell types and 6 functions from convert.ts are publicly available via index.ts.


Release Details

  • Date: 2026-03-22
  • Version: v0.32.0
  • gaslamp: version 75
  • pilotlamp: version 32
  • Files Changed: 13
  • Commits:
    • d82f3e2 feat(torch): add convert.ts with Primitive/Cell types and 6 pure conversion functions
    • bf74c91 test(torch): add unit tests for convert.ts (23 cases)
    • 78d1eee feat(torch): add minimal DataFrame (frame.ts) backed by Map
    • 581846a test(torch): add unit tests for frame.ts (43 cases)
    • ced0540 bump: version 0.31.0 → 0.32.0

Known Issues

  • frame.ts's DataFrame class is not yet re-exported from src/torch/index.ts due to a name conflict with the existing dataframe/ module. Import directly from ../../src/torch/frame until the replacement is complete.

Next Steps

  • Add sort / head / tail / slice to frame.ts
  • Gradually replace the existing dataframe/ module with frame.ts
  • Resolve the name conflict to enable re-export from index.ts