tur-frame

In-memory dataframe (Arrow-compatible columnar) for Turmeric.

Overview

tur-frame is a Tier 1 spice (pure Turmeric, no C deps). It provides an in-memory columnar dataframe implementation that follows the Apache Arrow memory layout (validity bitmap + values + offsets + 64-byte alignment). This makes frames compatible with the Arrow C Data Interface, so they can be handed to PyArrow, nanoarrow, DuckDB, Polars, and other Arrow consumers via the frame/interop module.

The spice exports modules for: type definitions, buffers, columns, schemas, frame construction, selection, filtering, sorting, joining, grouping, reshaping, CSV I/O, printing, and Arrow interop.

Install

:spices {
  "frame" {:url    "https://github.com/rjungemann/turmeric-spices"
           :ref    "frame-v0.2.0"
           :subdir "spices/frame"}
}

Quick start

(import frame/csv    :refer [read-csv-string])
(import frame/select :refer [select-cols])
(import frame/filter :refer [filter-mask])
(import frame/group  :refer [group-by agg agg-sum])
(import frame/print  :refer [print-frame])

(let [f       (read-csv-string "g,v\nA,10\nB,20\nA,30\n" 0 0 1 0 "")
      g       (group-by f (vec-of "g"))
      outs    (list "total")
      ins     (list "v")
      tags    (list (agg-sum))
      summary (agg g outs ins tags)]
  (print-frame summary))

See also