GitHub
deepbox/dataframe

Series

A one-dimensional labeled array, analogous to a single column of a DataFrame. Supports arithmetic, comparison, and aggregation operations.
new Series
new Series(data: T[], options?: { index?: (string | number)[]; name?: string; copy?: boolean })

Create a Series from an array of values with optional index labels and name.

Parameters:
data: T[] - Array of values for the series
options.name: string - Optional label for the series
options.index: (string | number)[] - Custom index labels (defaults to 0, 1, 2, ...)

Series Methods

  • .data — Read-only array of values
  • .name — Series name/label
  • .length — Number of elements
  • .index — Index labels
  • .mean(), .sum(), .min(), .max(), .std(), .var() — Aggregations
  • .unique() — Unique values
  • .valueCounts() — Value frequency counts
  • .sort(ascending?) — Sort values
  • .map(fn) — Apply function to each element
  • .filter(fn) — Filter elements by predicate
  • .toArray() — Convert to plain array
  • .toTensor() — Convert to Tensor
series.ts
import { Series } from "deepbox/dataframe";const s = new Series([10, 20, 30, 40, 50], { name: "values" });console.log(s.mean());     // 30console.log(s.sum());      // 150console.log(s.std());      // standard deviationconst doubled = s.map((v) => Number(v) * 2);  // [20, 40, 60, 80, 100]const above25 = s.filter((v) => Number(v) > 25); // [30, 40, 50]const t = s.toTensor(); // Convert to Tensor for numerical computing