Larkspur tabular transforms, kept small

Quickstart

Five minutes from an empty file to a working data step.

1. Read something

Frame.read_csv returns a lazy frame. Nothing is read until you iterate or write.

from larkspur import Frame
people = Frame.read_csv("people.csv")

2. Filter and reshape

Transforms are joined with the | operator. They run in order, one row at a time.

from larkspur import where, select, derive

adults = (
    people
    | where(lambda r: int(r["age"]) >= 18)
    | derive(initial=lambda r: r["name"][0].upper())
    | select("name", "initial", "age")
)

3. Write it out

adults.write_csv("adults.csv")     # or .write_ndjson(...)

4. Peek while developing

Use .head(n) to materialise just the first few rows without consuming the stream.

for row in adults.head(3):
    print(row)

That is the whole loop: read, chain transforms, write. Next, read Core concepts to understand what is happening underneath.