golars

package module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 12 Imported by: 0

README

golars

golars

Latest Release GoDoc CI Ask DeepWiki

Pure-Go DataFrames modeled on polars, built on Apache Arrow. No cgo.

Eager and lazy execution with a plan-rewriting optimiser, a streaming engine, and AVX2/AVX-512 kernels on amd64 and NEON on arm64. A single go build cross-compiles to Linux, macOS, Windows.

Matches or beats polars 1.39 on most polars-compare workloads, Arrow-native end to end (no conversion cost talking to polars, PyArrow, DuckDB), and ships a full terminal stack: REPL, LSP, formatter, linter, TUI data browser, SQL frontend, an MCP server for Claude Desktop / Cursor / Windsurf, and a pipe-friendly .glr scripting language.

Installation

# Homebrew (macOS / Linux)
brew install Gaurav-Gosain/tap/golars

# Arch Linux (AUR)
yay -S golars-bin

# One-shot curl installer (macOS / Linux, amd64 + arm64)
curl -fsSL https://raw.githubusercontent.com/Gaurav-Gosain/golars/main/install.sh | bash

From source

# library + all four CLIs
go install github.com/Gaurav-Gosain/golars/cmd/golars@latest
go install github.com/Gaurav-Gosain/golars/cmd/golars-lsp@latest
go install github.com/Gaurav-Gosain/golars/cmd/golars-mcp@latest
go install github.com/Gaurav-Gosain/golars/cmd/golars-kernel@latest

# or as a dependency in your Go module
go get github.com/Gaurav-Gosain/golars@latest

SIMD build (amd64)

GOEXPERIMENT=simd go install github.com/Gaurav-Gosain/golars/cmd/golars@latest

Enables AVX2/AVX-512 fast paths in the reduce, compare, blend, and arith-lit kernels. The scalar path is a correct fallback on any CPU that lacks SIMD.

Quickstart

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/Gaurav-Gosain/golars/dataframe"
    "github.com/Gaurav-Gosain/golars/expr"
    "github.com/Gaurav-Gosain/golars/lazy"
    "github.com/Gaurav-Gosain/golars/series"
)

func main() {
    ctx := context.Background()

    dept, _ := series.FromString("dept", []string{"eng", "eng", "sales", "ops"}, nil)
    salary, _ := series.FromInt64("salary", []int64{100, 120, 80, 70}, nil)
    df, _ := dataframe.New(dept, salary)
    defer df.Release()

    out, err := lazy.FromDataFrame(df).
        Filter(expr.Col("salary").Gt(expr.Lit(int64(75)))).
        GroupBy("dept").
        Agg(expr.Col("salary").Sum().Alias("total")).
        Sort("total", true).
        Collect(ctx)
    if err != nil {
        log.Fatal(err)
    }
    defer out.Release()
    fmt.Println(out)
}

CLI

The golars binary wraps an interactive REPL plus scriptable subcommands. golars help lists every one.

SQL against a file

golars sql

golars sql 'SELECT symbol, SUM(qty) AS vol FROM trades
            GROUP BY symbol ORDER BY vol DESC' trades.csv

# pipe-friendly output formats
golars sql --ndjson   '...' trades.csv | jq ...
golars sql --csv      '...' trades.csv | awk ...
golars sql --markdown '...' trades.csv >> report.md

Inspecting a file

golars schema / peek / stats

golars schema trades.csv        # columns + dtypes
golars peek   trades.csv        # schema + head + shape
golars stats  trades.csv        # describe()-style summary
golars head   trades.csv 20     # first 20 rows

Interactive TUI browser

golars browse

golars browse trades.csv

Vim-style modal grid (NORMAL / VISUAL / COMMAND / FILTER), layout cloned from maaslalani/sheets. / filters, s toggles sort, f freezes a column, : opens the command prompt (:sort col desc, :hide col, :goto 12345), ? shows the full legend. Navigate with h j k l or the arrow keys; gg / G jump to first / last row; Ctrl+d / Ctrl+u half- page scroll; q quits. Cells are pulled lazily from the Arrow backing store so it scales to tens of millions of rows without copying.

Composing with other tools

Every command speaks -o table|csv|tsv|json|ndjson|markdown|parquet|arrow, so golars drops straight into a Unix pipeline. --json, --csv, and friends are shorthand flags.

Diff two files

golars diff

golars diff --key ts trades.csv trades-v2.csv

Format conversion

golars convert

golars convert trades.csv     trades.parquet
golars convert trades.parquet trades.ndjson

CSV, TSV, Parquet, Arrow/IPC, JSON, NDJSON. All pairs work.

.glr scripting + explain + profile

.glr script run

# vhs/fixtures/pipeline.glr
load vhs/fixtures/people.csv
with monthly = salary / 12                 # derive columns via `with`
filter salary > 100000
groupby dept salary:sum:total salary:mean:avg tenure_years:max:max_tenure
sort total desc
head 5

with NAME = EXPR supports arithmetic, comparisons, string methods (col.str.upper(), contains_regex, like, ...), aggregates, rolling/EWM windows, casts, and coalesce. See docs/scripting.md for the full expression grammar.

Convert a .glr script to a standalone Go program:

golars transpile my-pipeline.glr -o main.go --package main
go run main.go

golars explain --profile

golars explain --profile my-pipeline.glr
golars explain --trace trace.json my-pipeline.glr    # chrome://tracing

Editor support

golars-lsp is a stdio Language Server for .glr files. Inlay hints display the frame shape after every statement, completion covers commands / frames / column names, hover shows signatures + long-form docs, and diagnostics flag unknown commands and missing files. Hover on a # ^? probe line returns a GitHub-flavoured markdown table of the frame at that point.

Neovim (lazy.nvim, remote):

{
  url = "https://github.com/Gaurav-Gosain/golars",
  name = "nvim-golars",
  ft = "glr",
  init = function() vim.filetype.add({ extension = { glr = "glr" } }) end,
  config = function()
    local root = vim.fn.stdpath("data") .. "/lazy/nvim-golars/editors/nvim-golars"
    vim.opt.rtp:prepend(root)
    vim.cmd("runtime! ftdetect/*.lua ftdetect/*.vim syntax/*.vim")
    require("golars").setup({})
  end,
}

See editors/nvim-golars for tree-sitter integration, per-option config, and a local-checkout variant.

Zed: grammar + LSP client ship as a Zed extension. The installer drops a prebuilt extension package (extension.wasm + tree-sitter grammar wasm + language assets) into Zed's installed-extensions directory, and auto-fetches golars-lsp from the same release if it's not already on PATH:

curl -fsSL https://raw.githubusercontent.com/Gaurav-Gosain/golars/main/install-zed-extension.sh | bash

Pin a specific version with a positional arg (... | bash -s -- v0.1.3). After the install completes, restart Zed (or run zed: reload extensions) and open any .glr file.

VS Code: grammar + LSP client at editors/vscode-golars.

Model Context Protocol server

golars-mcp

golars-mcp is a stdio JSON-RPC server that exposes schema, head, describe, sql, row_count, and null_counts as MCP tools any Claude Desktop / Cursor / Windsurf session can call against local files. See docs/mcp.md for the install walkthrough.

Jupyter

Two ways into the notebook:

golars-kernel install   # registers a .glr kernel; pick "golars (.glr)" in JupyterLab

golars-kernel is a native Jupyter kernel for the .glr scripting language. Frames render as HTML tables, state persists across cells, tab completion + hover docs work. The kernel speaks the v5.3 wire protocol over pure-Go ZeroMQ and delegates execution to a long-lived golars kernel-host subprocess so behaviour matches the REPL exactly.

For Go notebooks via GoNB, the jupyter/render package produces multi-mimetype output:

import jrender "github.com/Gaurav-Gosain/golars/jupyter/render"
import "github.com/janpfeifer/gonb/gonbui"

gonbui.DisplayHTML(jrender.HTML(df))

See docs/jupyter.md for the full walkthrough.

Performance

The polars-compare bench runs the same workloads against polars-py, the polars-rs crate, golars-scalar, and golars-simd in one pass. Categories covered include SumInt64, MeanFloat64, MinFloat64, GroupBy (single and multi-agg), InnerJoin, Filter, Take, WhenThenOtherwise, SumOverGroup, RollingSum, and end-to-end pipelines (filter-groupby-sort).

cd bench/polars-compare
uv run python compare.py --runs 5

The harness prints per-workload throughput in MB/s, typical and conservative ratios vs both polars frontends, and a stability breakdown (solid / noise / loss) so you can see which workloads are reproducibly faster on your hardware.

Library API

  • Eager + lazy: df.Filter(...) for in-place, lazy.FromDataFrame(df).Filter(...).Collect(ctx) for plan-optimised.
  • Expressions: Col, Lit, When/Then/Otherwise, binary ops, .Alias, .Cast, .Sum/Min/Max/Mean/Std/Var/Quantile/Skew/Kurtosis/Entropy, .RollingSum/Mean/..., .Over(keys...), .ForwardFill, .Coalesce, .IntRange.
  • Reshape: df.Pivot / Unpivot / Transpose / Explode / Unnest / Upsample / PartitionBy / TopK / BottomK / Pipe.
  • Horizontal: SumHorizontal / MeanHorizontal / MinHorizontal / MaxHorizontal / AllHorizontal / AnyHorizontal.
  • Stats: Skew / Kurtosis / Entropy / PearsonCorr / Covariance / ApproxNUnique, plus df.Corr / df.Cov matrices.
  • Optimiser: simplify, predicate pushdown, projection pushdown, slice pushdown, CSE.
  • Profiler + tracer: lazy.NewProfiler() + lazy.WithProfiler(p) for per-node timings; lazy.WithTracer(t) for OTel span integration.
// CSV, Parquet, Arrow/IPC, JSON, NDJSON - file or URL
df, _ := csv.ReadFile(ctx, "trades.csv")
df, _ := parquet.ReadURL(ctx, "https://example.com/trades.parquet")

// Lazy scans defer the open until Collect so the optimiser can push
// projections and filters through the reader
lf := golars.ScanCSV("huge.csv").
    Filter(golars.Col("region").EqLit("us")).
    Select(golars.Col("symbol"), golars.Col("price"))
out, _ := lf.Collect(ctx)

// Arrow IPC streaming: interop with polars / PyArrow / DuckDB over a
// socket or pipe
sw, _ := golars.NewIPCStreamWriter(conn, firstBatch)
for batch := range batches {
    sw.Write(ctx, batch)
}
sw.Close()

// database/sql bridge (any pure-Go driver)
db, _ := sql.Open("sqlite", "data.db")
df, _ := iosql.ReadSQL(ctx, db, "SELECT id, price FROM trades WHERE volume > ?", 100)

See the cookbook for end-to-end recipes and the API surface map for the polars ↔ golars method-level status table.

Tools

Binary / path What it is
cmd/golars REPL + run / sql / transpile / fmt / lint / browse / schema / stats / peek / diff / convert / cat / explain / doctor / completion / sample
cmd/golars-lsp stdio Language Server for .glr files
cmd/golars-mcp Model Context Protocol server
cmd/bench polars-compare bench harness
editors/tree-sitter-golars .glr grammar (Neovim, Helix)
editors/vscode-golars VS Code extension (grammar + LSP client)
editors/nvim-golars Neovim plugin
editors/zed-golars Zed extension (grammar + LSP client)
docs-site/ Fumadocs-based website, ships /llms.txt, /llms-full.txt, and /docs-md/<slug> raw-markdown routes for LLM ingestion

Documentation

File What
docs/cookbook.md End-to-end recipes for every major feature
docs/scripting.md .glr language reference
docs/mcp.md Install golars-mcp into Claude Desktop / Cursor / Windsurf
docs/api-surface.md Polars -> golars method-level status table
docs/api-design.md Naming + type philosophy
docs/architecture.md Layered component map + data flow
docs/parallelism.md Morsel engine + worker pool
docs/memory-model.md Refcounts + allocator hooks
docs/roadmap.md Phased delivery plan
examples/README.md Index of runnable demos
AGENTS.md, CLAUDE.md, SKILLS.md Guides for coding agents

Tests

make test           # go test ./...
make test-race      # race detector on hot packages
make test-simd      # GOEXPERIMENT=simd path
make test-all       # the full release gate
make bench          # polars-compare harness

Every test uses a testutil.CheckedAllocator so buffer leaks fail the suite.

Regenerating the GIFs

The demos above are produced by VHS. See vhs/ for the tape files. CI regenerates them on every tape-file change.

make -C vhs           # rebuild every gif
make -C vhs gif-sql   # one at a time

Attribution

  • polars by Ritchie Vink (MIT) - behavioural reference. golars mirrors its public API surface and parity-tests against a local clone.
  • arrow-go (Apache 2.0) - the only runtime dependency in the core packages; every series is an arrow array.
  • sheets by Maas Lalani (MIT) - grid layout and modal keybindings for the TUI browser in browse/.
  • bubble tea and lipgloss (MIT) - the whole Charm stack powers the REPL, browser, and LSP preview.
  • VHS (MIT) - tape-driven GIF regeneration for every demo above.
  • BurntSushi/toml (MIT) - config loader.
  • Goroutine-pool patterns for the parallel radix and filter kernels were informed by DuckDB's and polars's own parallel-radix writeups.

Full per-file attributions live in NOTICE.

License

MIT. See LICENSE.

Documentation

Overview

Package golars is the top-level facade that re-exports the most common types and helpers from the sub-packages so that a single

import "github.com/Gaurav-Gosain/golars"

brings DataFrame, Series, expression helpers, and I/O entry points into scope. The sub-packages stay the canonical homes; this file is sugar so users don't need to remember which package holds what.

polars users will recognise most of the names: `golars.Col`, `golars.Lit`, `golars.Sum`, `golars.ReadCSV`, `golars.Concat`, etc.

Index

Constants

View Source
const (
	InnerJoin = dataframe.InnerJoin
	LeftJoin  = dataframe.LeftJoin
	CrossJoin = dataframe.CrossJoin
)

Join-type constants surfaced at the top level.

Variables

View Source
var (
	Int64DType   = dtype.Int64
	Int32DType   = dtype.Int32
	Int16DType   = dtype.Int16
	Int8DType    = dtype.Int8
	UInt64DType  = dtype.Uint64
	UInt32DType  = dtype.Uint32
	UInt16DType  = dtype.Uint16
	UInt8DType   = dtype.Uint8
	Float64DType = dtype.Float64
	Float32DType = dtype.Float32
	StringDType  = dtype.String
	BoolDType    = dtype.Bool
	DateDType    = dtype.Date
	BinaryDType  = dtype.Binary
)

DTypes namespace: golars.Int64(), golars.String(), etc., matching polars' `pl.Int64`. Calling the function returns a DType value.

Functions

func NewIPCStreamReader

func NewIPCStreamReader(r io.Reader, opts ...ipc.Option) (*ipc.StreamReader, error)

NewIPCStreamReader wraps r as a streaming Arrow IPC reader.

func NewIPCStreamWriter

func NewIPCStreamWriter(w io.Writer, schemaFrame *DataFrame, opts ...ipc.Option) (*ipc.StreamWriter, error)

NewIPCStreamWriter wraps w as a streaming Arrow IPC writer. Use for multi-batch pipelines or cross-language streaming over a socket.

func When

func When(pred Expr) expr.WhenBuilder

When starts a when/then/otherwise conditional expression.

func WriteCSV

func WriteCSV(df *DataFrame, path string, opts ...iocsv.Option) error

WriteCSV serialises a DataFrame to a CSV file at path.

Default writer emits a header row and quotes only fields that contain the delimiter, a quote, or a newline. Pass iocsv.WithDelimiter to use TSV (`'\t'`) or regional separators.

func WriteIPC

func WriteIPC(df *DataFrame, path string, opts ...ipc.Option) error

WriteIPC writes df to an Arrow IPC file.

func WriteJSON

func WriteJSON(df *DataFrame, path string) error

WriteJSON writes df as an array of objects to a JSON file.

func WriteNDJSON

func WriteNDJSON(df *DataFrame, path string) error

WriteNDJSON writes df as newline-delimited JSON to a file.

func WriteParquet

func WriteParquet(df *DataFrame, path string, opts ...parquet.Option) error

WriteParquet writes df to a Parquet file.

Types

type DType

type DType = dtype.DType

DType is the logical dtype descriptor.

type DataFrame

type DataFrame = dataframe.DataFrame

DataFrame is the eager columnar table type. See package github.com/Gaurav-Gosain/golars/dataframe for the full API.

func Concat

func Concat(frames ...*DataFrame) (*DataFrame, error)

Concat vertically stacks DataFrames of the same schema.

func FromMap

func FromMap(data map[string]any, order []string) (*DataFrame, error)

FromMap builds a DataFrame from a column-name → slice map. order determines output column order (nil → alphabetical). Supported slice types mirror dataframe.FromMap.

func NewDataFrame

func NewDataFrame(cols ...*Series) (*DataFrame, error)

NewDataFrame builds a DataFrame from the given Series columns. Equivalent to dataframe.New.

func ReadCSV

func ReadCSV(path string, opts ...iocsv.Option) (*DataFrame, error)

ReadCSV reads a CSV file into a DataFrame.

Inference runs on the header + first rows: numeric columns become i64/f64, text becomes utf8. Pass iocsv.WithNullValues to treat specific tokens as nulls (empty string is a common choice to match polars defaults).

Uses context.Background; for cancellable reads call iocsv.ReadFile directly.

Example:

df, err := golars.ReadCSV("people.csv",
    iocsv.WithNullValues(""),          // empty field -> null
    iocsv.WithDelimiter(';'),          // European CSV
)
if err != nil { log.Fatal(err) }
defer df.Release()
fmt.Println(df.Schema())

func ReadCSVReader

func ReadCSVReader(r io.Reader, opts ...iocsv.Option) (*DataFrame, error)

ReadCSVReader reads a CSV stream from an io.Reader. Useful for http bodies, stdin, or embedded fixtures via strings.NewReader.

Example:

resp, _ := http.Get("https://example.com/data.csv")
defer resp.Body.Close()
df, err := golars.ReadCSVReader(resp.Body)

func ReadIPC

func ReadIPC(path string, opts ...ipc.Option) (*DataFrame, error)

ReadIPC reads an Arrow IPC file.

func ReadJSON

func ReadJSON(path string, opts ...iojson.Option) (*DataFrame, error)

ReadJSON reads a JSON (array-of-object) file.

func ReadNDJSON

func ReadNDJSON(path string, opts ...iojson.Option) (*DataFrame, error)

ReadNDJSON reads a newline-delimited JSON file.

func ReadParquet

func ReadParquet(path string, opts ...parquet.Option) (*DataFrame, error)

ReadParquet reads a Parquet file by path.

func SelectExpr

func SelectExpr(ctx context.Context, df *DataFrame, exprs ...Expr) (*DataFrame, error)

SelectExpr evaluates the given expressions against df and returns a new DataFrame holding their outputs in order. Equivalent to `golars.Lazy(df).Select(exprs...).Collect(ctx)` but reads more naturally for one-shot eager use.

func WithColumnsExpr

func WithColumnsExpr(ctx context.Context, df *DataFrame, exprs ...Expr) (*DataFrame, error)

WithColumnsExpr evaluates the given expressions and attaches their outputs to df as additional columns, returning a new DataFrame. Equivalent to `golars.Lazy(df).WithColumns(exprs...).Collect(ctx)`.

type Expr

type Expr = expr.Expr

Expr is the expression AST used to describe computations on columns. Built via Col, Lit, When, and fluent methods.

func BackwardFill

func BackwardFill(col string, limit int) Expr

BackwardFill is sugar for Col(col).BackwardFill(limit).

func Coalesce

func Coalesce(exprs ...Expr) Expr

Coalesce returns the first non-null value across exprs row-wise.

func Col

func Col(name string) Expr

Col references a named column.

func ConcatStr

func ConcatStr(sep string, exprs ...Expr) Expr

ConcatStr concatenates string forms of exprs using sep row-wise.

func Count

func Count(col string) Expr

func FillNan

func FillNan(col string, v float64) Expr

FillNan is sugar for Col(col).FillNan(v).

func First

func First(col string) Expr

func ForwardFill

func ForwardFill(col string, limit int) Expr

ForwardFill is sugar for Col(col).ForwardFill(limit).

func IntRange

func IntRange(start, end, step int64) Expr

IntRange produces an int64 sequence [start, end) with step.

func Last

func Last(col string) Expr

func Lit

func Lit(v any) Expr

Lit builds a literal with an inferred dtype.

func LitBool

func LitBool(v bool) Expr

func LitFloat64

func LitFloat64(v float64) Expr

func LitInt64

func LitInt64(v int64) Expr

LitInt64/LitFloat64/LitBool/LitString are typed literal builders.

func LitString

func LitString(v string) Expr

func Max

func Max(col string) Expr

func Mean

func Mean(col string) Expr

func Median

func Median(col string) Expr

func Min

func Min(col string) Expr

func NullCount

func NullCount(col string) Expr

func Ones

func Ones(n int) Expr

Ones produces a float64 Series of length n filled with 1.0.

func Std

func Std(col string) Expr

func Sum

func Sum(col string) Expr

Sum / Mean / Min / Max / Count / First / Last / Median / Std / Var are sugar for `golars.Col(name).<agg>()`. They match polars' top- level helpers: `pl.sum("a")` becomes `golars.Sum("a")`.

func Var

func Var(col string) Expr

func Zeros

func Zeros(n int) Expr

Zeros produces a float64 Series of length n filled with 0.0.

type JoinType

type JoinType = dataframe.JoinType

JoinType enumerates join kinds: golars.InnerJoin, golars.LeftJoin, golars.CrossJoin.

type LazyFrame

type LazyFrame = lazy.LazyFrame

LazyFrame is the deferred-execution pipeline handle. See package github.com/Gaurav-Gosain/golars/lazy.

func Lazy

func Lazy(df *DataFrame) LazyFrame

Lazy wraps df as a LazyFrame. polars-style alias for `lazy.FromDataFrame(df)`.

func ScanCSV

func ScanCSV(path string, opts ...iocsv.Option) LazyFrame

ScanCSV returns a LazyFrame backed by a CSV file on disk.

func ScanIPC

func ScanIPC(path string, opts ...ipc.Option) LazyFrame

ScanIPC returns a LazyFrame backed by an Arrow IPC file.

func ScanJSON

func ScanJSON(path string, opts ...iojson.Option) LazyFrame

ScanJSON returns a LazyFrame backed by a JSON array-of-object file.

func ScanNDJSON

func ScanNDJSON(path string, opts ...iojson.Option) LazyFrame

ScanNDJSON returns a LazyFrame backed by a newline-delimited JSON file.

func ScanParquet

func ScanParquet(path string, opts ...parquet.Option) LazyFrame

ScanParquet returns a LazyFrame backed by a Parquet file.

type Series

type Series = series.Series

Series is a named, chunked column. See package github.com/Gaurav-Gosain/golars/series.

func AllHorizontal

func AllHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

AllHorizontal returns a boolean Series that is true iff every boolean column is true at that row.

func AnyHorizontal

func AnyHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

AnyHorizontal is the disjunctive counterpart of AllHorizontal.

func Filter

func Filter(ctx context.Context, s *Series, mask *Series) (*Series, error)

Filter runs a compute-level filter on a series + mask. Convenience that avoids importing compute for one-line use.

func FromBool

func FromBool(name string, v []bool, valid []bool) (*Series, error)

func FromFloat32

func FromFloat32(name string, v []float32, valid []bool) (*Series, error)

func FromFloat64

func FromFloat64(name string, v []float64, valid []bool) (*Series, error)

func FromInt32

func FromInt32(name string, v []int32, valid []bool) (*Series, error)

func FromInt64

func FromInt64(name string, v []int64, valid []bool) (*Series, error)

FromInt64 / FromFloat64 / FromString / FromBool are shortcuts to construct a Series from a native Go slice without remembering which sub-package exports each builder.

func FromString

func FromString(name string, v []string, valid []bool) (*Series, error)

func MaxHorizontal

func MaxHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

MaxHorizontal returns a Series of row-wise maxima.

func MeanHorizontal

func MeanHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

MeanHorizontal returns a Series of row-wise means.

func MinHorizontal

func MinHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

MinHorizontal returns a Series of row-wise minima.

func SumHorizontal

func SumHorizontal(ctx context.Context, df *DataFrame, cols ...string) (*Series, error)

SumHorizontal returns a Series of row-wise sums. See DataFrame.SumHorizontal for details.

func Take

func Take(ctx context.Context, s *Series, indices []int) (*Series, error)

Take picks the rows at indices (see compute.Take).

Directories

Path Synopsis
bench
pds-h/cmd/pdsh command
Command pdsh runs one or more PDS-H / TPC-H queries against a directory of parquet tables and emits per-run timings to bench/pds-h/output/timings.csv in the upstream polars-benchmark schema.
Command pdsh runs one or more PDS-H / TPC-H queries against a directory of parquet tables and emits per-run timings to bench/pds-h/output/timings.csv in the upstream polars-benchmark schema.
pds-h/gen command
Command gen writes a tiny synthetic lineitem.parquet with just enough columns and row count for local Q1/Q6 development.
Command gen writes a tiny synthetic lineitem.parquet with just enough columns and row count for local Q1/Q6 development.
pds-h/queries
Package queries holds the golars implementations of the PDS-H / TPC-H query set.
Package queries holds the golars implementations of the PDS-H / TPC-H query set.
Package browse provides an interactive TUI DataFrame viewer.
Package browse provides an interactive TUI DataFrame viewer.
cmd
bench command
Command bench runs the same workloads the polars harness runs and emits JSON with matching schema.
Command bench runs the same workloads the polars harness runs and emits JSON with matching schema.
golars command
Command golars is an interactive REPL for exploring DataFrames with golars.
Command golars is an interactive REPL for exploring DataFrames with golars.
golars-kernel command
Command golars-kernel is a Jupyter kernel for the golars `.glr` scripting language.
Command golars-kernel is a Jupyter kernel for the golars `.glr` scripting language.
golars-lsp command
Command golars-lsp is a minimal Language Server for golars .glr scripts.
Command golars-lsp is a minimal Language Server for golars .glr scripts.
golars-mcp command
Command golars-mcp is a Model Context Protocol server that exposes a read-only subset of golars as tools an LLM host (Claude Desktop, Cursor, Windsurf, ...) can invoke.
Command golars-mcp is a Model Context Protocol server that exposes a read-only subset of golars as tools an LLM host (Claude Desktop, Cursor, Windsurf, ...) can invoke.
profiled-bench command
profiled-bench runs a subset of the compare4 workloads with a CPU profile attached so we can see where real time goes across the benchmark suite, not just one workload in isolation.
profiled-bench runs a subset of the compare4 workloads with a CPU profile attached so we can see where real time goes across the benchmark suite, not just one workload in isolation.
Package compute holds the vectorized kernel library.
Package compute holds the vectorized kernel library.
Package dataframe defines DataFrame, an ordered collection of equal-length Series.
Package dataframe defines DataFrame, an ordered collection of equal-length Series.
Package dtype defines the logical data types used by golars.
Package dtype defines the logical data types used by golars.
Package eval evaluates expr.Expr trees against a DataFrame.
Package eval evaluates expr.Expr trees against a DataFrame.
examples
arrow_interop command
Arrow interop: DataFrame ↔ arrow.RecordBatch / arrow.Table.
Arrow interop: DataFrame ↔ arrow.RecordBatch / arrow.Table.
basic command
Build a DataFrame from slices, then take the head, filter, and sort.
Build a DataFrame from slices, then take the head, filter, and sort.
coalesce_concat command
Coalesce + ConcatStr + IntRange - polars-style constructors.
Coalesce + ConcatStr + IntRange - polars-style constructors.
coalesce_concat/generic command
Typed-column variant of ./examples/coalesce_concat.
Typed-column variant of ./examples/coalesce_concat.
csv command
Write a DataFrame to CSV and read it back.
Write a DataFrame to CSV and read it back.
csv_url command
Fetch a CSV from an http(s) URL.
Fetch a CSV from an http(s) URL.
describe command
DataFrame.Describe: summary statistics for every column.
DataFrame.Describe: summary statistics for every column.
expressions command
Column expressions used in select/with_columns.
Column expressions used in select/with_columns.
expressions/generic command
Typed-column variant of ./examples/expressions.
Typed-column variant of ./examples/expressions.
fill_strategies command
FillNull, ForwardFill, BackwardFill, FillNan.
FillNull, ForwardFill, BackwardFill, FillNan.
groupby command
Group by a key column and run per-group aggregations.
Group by a key column and run per-group aggregations.
groupby/generic command
Typed-column variant of ./examples/groupby.
Typed-column variant of ./examples/groupby.
horizontal command
Row-wise aggregates: SumHorizontal, MeanHorizontal, MinHorizontal.
Row-wise aggregates: SumHorizontal, MeanHorizontal, MinHorizontal.
ipc_streaming command
Write + read an Arrow IPC stream (cross-language binary format).
Write + read an Arrow IPC stream (cross-language binary format).
join command
Inner and left joins across two DataFrames.
Inner and left joins across two DataFrames.
json command
Parse JSON (array of objects) into a DataFrame and write it back.
Parse JSON (array of objects) into a DataFrame and write it back.
lazy command
Build and collect a lazy pipeline: filter -> groupby -> sort.
Build and collect a lazy pipeline: filter -> groupby -> sort.
lazy/generic command
Typed-column variant of ./examples/lazy.
Typed-column variant of ./examples/lazy.
ndjson command
Parse newline-delimited JSON (one object per line) into a DataFrame.
Parse newline-delimited JSON (one object per line) into a DataFrame.
over_window command
Window functions via Expr.Over(keys...).
Window functions via Expr.Over(keys...).
over_window/generic command
Typed-column variant of ./examples/over_window.
Typed-column variant of ./examples/over_window.
parquet command
Write a DataFrame to Parquet and read it back.
Write a DataFrame to Parquet and read it back.
pivot command
Pivot: long → wide reshape.
Pivot: long → wide reshape.
profiler command
Attach a profiler to a lazy plan and print per-node timings.
Attach a profiler to a lazy plan and print per-node timings.
profiler/generic command
Typed-column variant of ./examples/profiler.
Typed-column variant of ./examples/profiler.
regex_strings command
Regex + string ops: Extract, ContainsRegex, SplitN. Run: go run ./examples/regex_strings
Regex + string ops: Extract, ContainsRegex, SplitN. Run: go run ./examples/regex_strings
rolling command
Rolling sum / mean / std on a single-column time series.
Rolling sum / mean / std on a single-column time series.
rolling/generic command
Typed-column variant of ./examples/rolling.
Typed-column variant of ./examples/rolling.
scan_pushdown command
Lazy scan with predicate + projection pushdown.
Lazy scan with predicate + projection pushdown.
scan_pushdown/generic command
Typed-column variant of ./examples/scan_pushdown.
Typed-column variant of ./examples/scan_pushdown.
script command
Shows how to drive a golars pipeline from a script file via the public script package.
Shows how to drive a golars pipeline from a script file via the public script package.
script/transpiled/agg command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/branching command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/demo command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/derived command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/join command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/multisource command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/nulls command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/pipeline command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/regex command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
script/transpiled/rolling command
Code generated by `golars transpile`.
Code generated by `golars transpile`.
sql_session command
Register in-memory DataFrames and run SQL against them.
Register in-memory DataFrames and run SQL against them.
stats command
Stats: skew, kurtosis, corr, cov, approx_n_unique.
Stats: skew, kurtosis, corr, cov, approx_n_unique.
streaming command
Run a pipeline through the streaming/morsel engine.
Run a pipeline through the streaming/morsel engine.
streaming/generic command
Typed-column variant of ./examples/streaming.
Typed-column variant of ./examples/streaming.
topk_pipe command
TopK / BottomK / Pipe - nicer alternatives to Sort+Head.
TopK / BottomK / Pipe - nicer alternatives to Sort+Head.
transpose_unpivot command
Transpose and Unpivot (melt).
Transpose and Unpivot (melt).
when_then command
Conditional expressions with when().then().otherwise().
Conditional expressions with when().then().otherwise().
when_then/generic command
Typed-column variant of ./examples/when_then.
Typed-column variant of ./examples/when_then.
Package expr defines the golars expression AST.
Package expr defines the golars expression AST.
internal
assert
Package assert provides runtime invariant checks for internal callers.
Package assert provides runtime invariant checks for internal callers.
intmap
Package intmap provides a fast, purpose-built open-addressing hash map keyed on int64 with int32 values.
Package intmap provides a fast, purpose-built open-addressing hash map keyed on int64 with int32 values.
mempool
Package mempool owns the process-global pooled arrow allocator shared by hot-loop kernels across compute, series, dataframe, and lazy.
Package mempool owns the process-global pooled arrow allocator shared by hot-loop kernels across compute, series, dataframe, and lazy.
pool
Package pool provides goroutine-pool primitives used by compute kernels and the in-memory executor.
Package pool provides goroutine-pool primitives used by compute kernels and the in-memory executor.
testutil
Package testutil provides test helpers for the golars module.
Package testutil provides test helpers for the golars module.
io
clipboard
Package clipboard reads and writes DataFrames to the OS clipboard as CSV text.
Package clipboard reads and writes DataFrames to the OS clipboard as CSV text.
csv
Package csv reads and writes RFC 4180 CSV using arrow-go's csv package.
Package csv reads and writes RFC 4180 CSV using arrow-go's csv package.
ipc
Package ipc reads and writes the Arrow IPC stream format.
Package ipc reads and writes the Arrow IPC stream format.
json
Package json reads and writes JSON and newline-delimited JSON (NDJSON), mirroring polars' pl.read_json / pl.read_ndjson / pl.write_json.
Package json reads and writes JSON and newline-delimited JSON (NDJSON), mirroring polars' pl.read_json / pl.read_ndjson / pl.write_json.
parquet
Package parquet reads and writes Parquet files using arrow-go's pqarrow bridge.
Package parquet reads and writes Parquet files using arrow-go's pqarrow bridge.
sql
Package sql reads golars DataFrames from any database/sql source.
Package sql reads golars DataFrames from any database/sql source.
jupyter
render
Package render produces multi-mimetype representations of golars values for Jupyter and other notebook frontends.
Package render produces multi-mimetype representations of golars values for Jupyter and other notebook frontends.
Package lazy provides the lazy query planner, optimizer, and executor.
Package lazy provides the lazy query planner, optimizer, and executor.
Package repl is a reusable building block for terminal REPLs with inline ghost-text completions, persistent history, and a non-TTY fallback for piped input and scripting.
Package repl is a reusable building block for terminal REPLs with inline ghost-text completions, persistent history, and a non-TTY fallback for piped input and scripting.
Package schema defines the Schema type, an ordered, immutable collection of named column dtypes.
Package schema defines the Schema type, an ordered, immutable collection of named column dtypes.
Package script runs a very small pipe-style language against any backend that implements the Executor interface.
Package script runs a very small pipe-style language against any backend that implements the Executor interface.
exprparse
Package exprparse turns a short text expression into an expr.Expr.
Package exprparse turns a short text expression into an expr.Expr.
predparse
Package predparse parses the `.filter` predicate DSL used by the golars REPL, the script runner, and the glr-to-Go transpiler into an expr.Expr tree.
Package predparse parses the `.filter` predicate DSL used by the golars REPL, the script runner, and the glr-to-Go transpiler into an expr.Expr tree.
transpile
Package transpile converts a .glr script into a self-contained Go program that reproduces the pipeline using the golars library API.
Package transpile converts a .glr script into a self-contained Go program that reproduces the pipeline using the golars library API.
Package selector builds column-set predicates for DataFrame operations.
Package selector builds column-set predicates for DataFrame operations.
Package series defines Series, a named, chunked, nullable column.
Package series defines Series, a named, chunked, nullable column.
Package sql is a tiny SQL frontend for golars.
Package sql is a tiny SQL frontend for golars.
Package stream provides the morsel-driven streaming executor.
Package stream provides the morsel-driven streaming executor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL