DataFrames¶
DataFrame(rows) creates an immutable query plan over an existing List<Record>. The rows remain in the same persistent, copy-on-write list storage. Chaining a filter, projection, sort, aggregation, or join builds a bounded plan. SQLite executes that plan when to_list(), a Series reduction, or len() requests values. There is no Python/Pandas dependency and no second Rust row-processing engine.
type Measurement = {case_name: String, before: Number, after: Number}
let df = DataFrame(read<List<Measurement>>("measurements.csv"))
let faster = df[df["after"] < df["before"]]
let ratios = faster.assign({ratio=faster["before"] / faster["after"]})
let summary = ratios.groupby("case_name").agg({before="mean", after="mean", ratio="mean"})
let result = summary.to_list()
let values = ratios["ratio"].to_list()
The familiar Pandas operations have a deliberately static contract:
Operation |
Result |
|---|---|
|
A typed lazy |
|
A projection with exactly those fields |
|
A lazy row filter |
|
A frame with added/replaced columns |
|
A projection excluding columns |
|
A renamed schema |
|
A stable sort; missing values last |
|
The first/last rows in current logical order |
|
Grouped aggregation, group keys sorted, missing keys omitted |
|
Mean of compatible numeric non-key columns |
|
A typed inner/left join, with |
|
A missingness mask / filled column |
|
Rows without missing values in selected columns |
|
A typed materialized row/scalar list |
|
A scalar SQLite reduction |
|
Column names in canonical schema order |
|
The number of rows, computed by SQLite |
Column names and schema-changing mappings must be literal strings, so unknown columns, incompatible aggregates, duplicate output names, and invalid joins fail before execution. A Series mask or assigned expression must come from the same row plan. Build expressions from the filtered frame after filtering; unrelated rows are never silently aligned. Use merge to combine frames explicitly.
Unlike mutable Pandas objects, methods return new plans and let bindings remain immutable. Rows have a stable internal positional order, without a user-defined Pandas index. Column ordering follows Ebi’s canonical record schema ordering. Both groupby("one") and groupby(["one", "two"]) are supported. Aggregate operations are count, size, mean, sum, min, and max; agg takes one operation per selected column. Join modes are inner and left, with optional suffixes=["_left", "_right"]. These supported operations are Pandas-inspired, not an implementation of the entire Pandas library.
Missing data uses Option<T>. Empty numeric sums are zero; empty means and minima/maxima are None. count ignores missing values; size counts rows. Nullable arithmetic stays nullable, while comparisons produce total boolean masks and treat missing operands as false. isna() tests missingness explicitly. Division by zero or incompatible SQLite result values produce a source-located error. Series arithmetic supports +, -, *, /, %, comparisons, and boolean and/or/not. Other operators fail during static checking.
Materialized results share the existing query-result cache. Imported in-memory SQLite snapshots also have a byte/entry-bounded LRU, so different queries over unchanged input tables reuse their imports. Editing source data changes the fingerprint; restoring a code checkpoint preserves its immutable plans. Cache keys include exact limits and warm queries retain the original input cell and instruction costs, so cache reuse cannot bypass a stricter budget. Plan depth, node count, columns, SQL size, cells, pages, and SQLite VM work remain bounded.
Use shrimply ebi lint for static diagnostics and shrimply ebi profile to measure actual query execution/cache reuse. Materializations inside loops receive performance advice; slow executed queries report P003. Native charts consume ordinary typed lists, for example Histogram(values=df["value"].to_list()). The direct query(...) API remains available and uses the same SQLite executor.