All docs
API Reference
Table
Table is lsdtools' immutable, zero-copy wrapper over an Arrow table — the data that flows between steps. Reference for every method, with examples.
Table is the data that flows between steps — an immutable, zero-copy view over one
pyarrow.Table. Every verb returns a new Table (or a Column), and each
compiles to a single Arrow compute kernel, so chains stay zero-copy and fast. The point is that a
geologist never types pyarrow.compute and an LLM gets a small, promptable verb list — while
performance stays identical to raw pyarrow.
Usage#
Build one by calling the Table(...) constructor, then chain verbs:
Python
from lsdtools import Table
t = Table({"name": ["ann", "bob", "cy"], "score": [12, 30, 7]})
top = t.filter(t["score"] > 10).sort("score", descending=True)
top.print()
# → name:["bob","ann"] score:[30,12]
Inside a step you receive a Table as an input port and return one:
Python
@tool.shape
def keep_top(t: Table, cutoff: int = 10) -> Table:
return t.filter(t["score"] >= cutoff)
Where to start#
Learn — Tables & data flow · Shape steps
Examples — Clean a CSV
Properties
- arrow the underlying pyarrow.Table, the zero-copy escape hatch
- columns the list of column names, in order
- schema the arrow schema — column names and their types
Methods
- drop removes the named columns, keeping the rest
- filter keeps the rows where a boolean mask column is true
- group_by groups by one or more columns; chain .agg to reduce
- head takes the first n rows
- join joins to another table on a key column
- null_report summarises null counts per column as a small table
- print prints a compact preview and returns self for chaining
- rename renames columns from an {old: new} mapping
- select keeps only the named columns, in the given order
- sort sorts by one or more columns, ascending or descending
- to_pylist materialises to a list of row dicts (preview/small tables)
- with_column adds or replaces a column from a column expression or array
- write_csv writes the table to a csv file
- write_parquet writes the table to a parquet file
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown