Skip to content
Open in Anthropic

Migration Guide

Coming from pandas (Python), Polars, or SQL? Here is your cheat sheet.

From pandas (Python)

Operationpandas (Python)Molniya (TypeScript)
Read CSVpd.read_csv("data.csv")readCsv("data.csv")
Inspectdf.head()df.head().print()
Select Coldf["price"]df.col("price")
Filterdf[df["age"] > 18]df.filter(r => r.age > 18)
Sortdf.sort_values("date")df.sort("date")
New Columndf["total"] = df["a"] + df["b"]df = df.assign("total", r => r.a + r.b)
GroupBydf.groupby("dept").sum()df.groupby("dept").sum("val")
Mapdf["a"].map(fn)df.col("a").map(fn)
Uniquedf["a"].unique()df.col("a").unique()

NOTE

Key Difference: pandas modifies dataframes in-place for many operations (or has inplace=True). Molniya is always immutable. You must assign the result: df = df.sort(...)

From SQL

ConceptSQLMolniya
SELECTSELECT name, age.select('name', 'age')
WHEREWHERE age > 18.filter(r => r.age > 18)
ORDER BYORDER BY date DESC.sort('date', false)
LIMITLIMIT 5.head(5)
GROUP BYGROUP BY dept.groupby('dept')
HAVINGHAVING count > 10.groupby(...).count().filter(...)
JOINLEFT JOIN other ON ....merge(other, { how: 'left', ... })

From Plain JavaScript (Arrays)

OperationArray of ObjectsMolniya DataFrame
MemoryHeavy (objects per row)Efficient (typed arrays)
Filterarr.filter(fn)df.filter(fn)
Maparr.map(fn)df.assign(name, fn)
Sortarr.sort((a,b) => a - b)df.sort('col')
StatsManual (reduce loops).mean(), .sum(), .std()

Type Safety

One major upgrade from pandas is strict typing.

pandas: Columns can contain mixed types ("10", 10, None) silently.

Molniya: Columns are strictly typed. If a column is int32, you cannot put a string in it. This prevents an entire class of "cleaning" bugs.

Released under the MIT License.