FrankenPandas

Clean-room Rustpandas 2.2.3 semanticsv0.7.1

pandas, rebuilt in safe Rust.

FrankenPandas is the pandas API rewritten from scratch in Rust: DataFrame, Series, the index types, groupby, merge, windows, eval and query, and more than a dozen file formats. Its behavior is checked against pandas 2.2.3 running live, and it is faster than pandas on 136 of 146 certified benchmark lanes. Use it as a Rust crate, or from Python as import frankenpandas as pd.

orders.ipynbFrankenPandas · wasm32
In [1]:
df.query("units > 6").groupby("region").agg(total=("units", "sum"), orders=("units", "count"))
Out[1]:
regiontotalfloat64ordersint64
east30.02
north20.02
south16.02
west31.02
4 rows × 2 columns

The FrankenPandas crates, compiled to WebAssembly, produced this answer when the page was built. With JavaScript on, each example runs again in your browser.

ran in
8.7 ms
where
at build time
engine
–
  • 3.97×geometric-mean speedup over pandas on 146 certified lanes
  • 1,387conformance packets replayed against live pandas 2.2.3
  • 0unsafe blocks: all 15 crates declare #![forbid(unsafe_code)]
  • 9,902#[test] functions, plus 31 fuzz targets

Why it exists

pandas behavior, without pandas' runtime.

pandas code depends on pandas' rules: rows align by label, missing values propagate, dtypes promote in particular ways. Faster libraries change those rules. Polars has no index, and SQL engines have no row labels, so moving to them means rewriting code and re-checking every result. FrankenPandas keeps the rules and replaces the Python and C underneath with safe Rust.

Rust programs that need pandas semantics

Services, command-line tools and WebAssembly builds get index alignment, nullable dtypes and pandas' method names with no Python interpreter. Every figure on this page runs on the same crates, compiled to wasm32-wasip1.

A second implementation to check pandas code against

Each of the 1,387 conformance packets records what pandas 2.2.3 returned. Where FrankenPandas departs from pandas on purpose, DISCREPANCIES.md says so, with a test: 24 active entries, 14 resolved.

Largest gains on strings and joins

Geometric means by category over the certified lanes: strings 7.29×, joins 6.82×, indexing 5.69×, rolling windows 5.03×, groupby 4.72×. Ten lanes are slower than pandas, and the speed chapter lists every one.

Memory safety you can audit

No unsafe in any crate, no tokio anywhere in Cargo.lock (a test fails the build if it appears), and charts drawn as SVG by Rust code instead of matplotlib.

01 · Playground

Type a pandas line. FrankenPandas runs it.

Two tables are loaded: df, twelve orders with one missing unit count, and regions, one row per sales region. Edit the line and press Run. The page splits the method chain into calls and sends each call to the FrankenPandas Rust API; the strings inside query and eval are parsed by fp-expr, the project's own expression engine.

Interactive · runs in this tab

This demo wires about sixty methods so that it can explain each step. The library has more than 960 on DataFrame and 800 on Series, five typed indexes, MultiIndex on both axes, and string, datetime and categorical accessors.

02 · Index alignment

Rows match by label, before any arithmetic.

In pandas, a + b pairs rows by index label, not by position. A label on one side only gives NaN; a repeated label pairs with every match. That rule makes pandas code short, and it is the first thing a port to another library loses. FrankenPandas builds an explicit alignment plan for every binary operation before it touches data (the README calls this Alignment-Aware Columnar Execution), and can record each plan in an evidence ledger.

Interactive · runs in this tab

The dtype depends on which side has the gap

Measured on live pandas 2.2.3: a nullable Int64 Series with labels a, b, c times a numpy int64 Series with labels a, b returns Float64. Swap which side is missing a label and the same two dtypes return Int64. FrankenPandas reproduces both, and the measurement sits in a comment next to the code that does it.

The ledger records what happened

With a ledger attached, each operation leaves a semantic witness: the operation, the alignment mode, SHA-256 fingerprints of the input and output indexes, whether either had duplicates, and the ordering contract the output follows. The figure shows the witness from each run.

03 · Missing data

Every kind of missing, one bit per row.

pandas distinguishes None, NaN and NaT, and its nullable dtypes use three-valued logic: True | NA is True, False & NA is False, and the other combinations stay NA. FrankenPandas keeps the distinctions and stores missingness as a validity bitmap, 64 rows to a machine word (with shorter encodings for columns that have no gaps or long runs of them), so counting the present values is a popcount.

Interactive · runs in this tab

04 · Conformance

pandas is the test oracle.

A conformance packet holds inputs, an operation, a runtime mode, and the output pandas 2.2.3 produced for them. CI replays all 1,387 packets against a pinned, live pandas install every day and on every pull request. This figure replays the ones it can in your browser: every packet for fourteen operations that uses only options the page implements, compared with the rule the harness uses.

  • 1,387packet files, 459 packet ids
  • 360distinct operations covered
  • 38documented divergences, 24 active
  • 1,311Python tests that diff the binding against pandas

Interactive · replays real packets in this tab

Divergences are written down

When FrankenPandas answers differently from pandas on purpose, the difference gets a number, a root cause, a status and a test. Four of the 24 active entries:

Random inputs, compared with pandas nightly

Hand-written packets cover the cases someone thought of. fuzz_differential_vs_pandas builds random frames and operations, runs them through both libraries, and fails on any difference; a nightly workflow provisions the pinned pandas oracle to run it. It is one of 31 fuzz targets. CLAIMS.md maps each claim in the README to the test that backs it, and NEGATIVE_EVIDENCE.md keeps the optimizations that did not work.

05 · Performance

Faster on 136 of 146 lanes. Slower on 10.

A lane is one workload at one size and dtype, timed against pandas in the same harness run. The harness alternates the two in an ABBAABBA pattern over 25 paired rounds after 3 warmups, bootstraps a confidence interval for the ratio (10,000 resamples), and certifies the lane only if that interval clears an A/A null control run alongside it. Lanes that fail the gate are counted and kept out of the averages. Over the 146 certified lanes the geometric mean is 3.97×; over the 80 where both libraries ran on one thread, 3.85×.

Every certified lane · select a dot for details

Certified benchmark lanes, pandas time divided by FrankenPandas time146 certified lanes, one dot each, grouped by category on a log scale. Right of the 1× line FrankenPandas is faster. Geometric mean 3.97×.0.01×0.1×1×10×100×pandas fasterFrankenPandas fastergeomean 3.97×strings13 lanes · 7.30×str_value_counts_arrow · 1M · float64: 1.36×str_sort_arrow · 1M · float64: 1.46×str_groupby_sum_arrow · 1M · float64: 2.87×str_contains_arrow · 100k · float64: 4.31×str_startswith_arrow · 1M · float64: 4.96×str_value_counts · 100k · float64: 5.13×str_contains_arrow · 1M · float64: 10.1×str_sort · 1M · float64: 10.2×str_sort · 100k · float64: 10.6×str_len · 1M · float64: 11.5×str_contains_arrow · 10M · float64: 15.7×str_len · 100k · float64: 29.0×str_len · 10k · float64: 46.7×joins4 lanes · 6.82×join_left · 1M · float64: 2.49×join_inner_str · 1M · float64: 7.79×join_inner · 1M · float64: 9.37×join_inner_validate_one_to_many · 1M · float64: 11.9×indexing9 lanes · 5.69×iloc_slice · 100k · float64_nan10: 1.18×loc_labels · 100k · float64_nan10: 1.36×reindex · 1M · float64: 1.44×affine_index_take_arithmetic · 1M · float64: 1.44×iloc_slice · 100k · int64: 6.33×iloc_slice · 10k · float64: 6.43×loc_labels · 1M · float64: 9.43×loc_labels · 10k · float64: 11.4×range_index_values · 100k · float64: 431×rolling13 lanes · 5.03×ewm_mean · 100k · float64: 1.17×rolling_mean_w10 · 100k · float64: 1.25×rolling_mean_w10 · 1M · float64: 1.97×expanding_sum · 100k · float64: 2.52×df_groupby_rolling_mean_w10 · 100k · float64: 5.60×df_groupby_ewm_mean · 100k · float64: 5.65×df_groupby_ewm_mean · 1M · float64: 6.91×df_groupby_rolling_mean_w10 · 1M · float64: 7.16×df_groupby_expanding_mean · 100k · float64: 7.41×groupby_rolling_mean_w10 · 1M · float64: 7.59×rolling_apply_stateful · 100k · float64: 8.16×df_groupby_expanding_mean · 1M · float64: 8.61×expanding_apply_stateful · 100k · float64: 29.3×io8 lanes · 4.81×csv_read_block_view · 1M · float64: 3.03×csv_read_file_uncached · 200k · float64: 3.24×csv_read_uncached · 200k · float64: 3.36×csv_read · 200k · float64: 3.50×csv_read · 1M · float64: 3.59×csv_read · 2M · float64: 3.67×csv_read_uncached · 100k · float64: 4.28×json_read_records · 1M · float64: 44.4×groupby9 lanes · 4.72×df_groupby_2strkey_sum · 100k · float64: 1.50×df_groupby_2strkey_sum · 10k · float64: 1.61×groupby_count · 100k · float64: 2.24×groupby_sum_int64 · 100k · float64: 5.03×groupby_mean_float64 · 100k · float64: 5.37×groupby_sum_int64 · 1M · float64: 5.96×groupby_sem_str · 1M · float64: 7.21×groupby_var_str · 1M · float64: 11.0×groupby_min_str · 1M · float64: 16.8×pipeline2 lanes · 4.64×etl_job_uncached · 1M · float64: 2.53×etl_job_uncached · 10k · float64: 8.51×dataframe ops35 lanes · 4.58×df_transpose_full_materialize · 100k · float64: 0.004×df_transpose_full_materialize_positional · 100k · float64: 0.005×df_transpose_full_materialize · 10k · float64: 0.057×drop_duplicates · 100k · float64_nan10: 0.840×series_kurtosis · 100k · float64_nan10: 1.16×cumsum · 10k · float64: 1.17×series_skew · 100k · float64_nan10: 1.19×sort_values_single · 10k · float64: 1.27×df_abs · 100k · float64: 1.31×df_sem · 10k · float64: 1.57×df_abs · 1M · float64: 1.61×value_counts · 10k · float64: 2.04×astype_str_f64 · 10k · float64: 2.43×df_sem · 100k · float64_nan10: 2.64×cumsum · 1k · float64: 3.21×drop_duplicates · 100k · float64: 3.58×sort_values_multi · 10k · float64: 4.07×df_explode · 10k · float64: 4.15×filter_bool_mask · 10k · float64: 4.63×drop_duplicates · 10k · float64: 5.03×df_pivot · 10k · float64: 5.15×df_skew · 10k · float64: 5.39×df_explode_string_python · 1M · float64: 8.29×cumsum · 1M · float64: 12.2×df_sem · 1M · float64: 14.9×series_kurtosis · 1M · float64: 17.8×series_skew · 1M · float64: 19.3×df_skew · 1M · float64: 28.8×df_melt · 10k · float64: 30.4×df_transpose_materialized_clone · 1k · float64: 33.0×df_transpose_materialize · 10k · float64: 96.5×df_apply_row · 10k · float64: 220×df_iterrows · 10k · float64: 271×df_transpose · 10k · float64: 279×df_transpose_materialize · 100k · float64: 533×datetime4 lanes · 3.27×to_datetime · 1M · float64: 1.44×dt_floor · 100k · float64: 1.86×dt_date · 100k · float64: 4.19×dt_strftime · 1M · float64: 10.2×linalg3 lanes · 3.07×df_dot · 10k · float64: 1.13×df_dot · 1M · float64: 1.55×df_dot · 100k · float64: 16.6×math unary46 lanes · 2.39×floor · 4M · float64: 0.310×div · 1M · float64: 0.885×expm1 · 100k · float64: 0.895×sqrt · 10M · float64: 0.900×log · 100k · float64: 0.942×log_int64 · 100k · float64: 0.948×round2 · 1M · float64: 1.10×atan2 · 100k · float64: 1.13×sqrt · 100k · float64: 1.16×sqrt_int64 · 100k · float64: 1.17×floor · 1M · float64: 1.33×floor · 10M · float64: 1.35×trunc · 10M · float64: 1.36×ceil · 10M · float64: 1.36×ceil · 1M · float64: 1.38×hypot · 100k · float64: 1.43×trunc · 1M · float64: 1.44×log10 · 100k · float64: 1.58×log · 10k · float64: 1.67×sqrt_int64 · 10M · float64: 1.71×sqrt · 1M · float64: 1.73×atan · 100k · float64: 1.74×log1p · 100k · float64: 1.96×cbrt · 100k · float64: 2.05×log · 1M · float64: 2.10×expm1 · 10M · float64: 2.23×log2 · 10M · float64: 2.25×log_int64 · 10M · float64: 2.30×round2 · 10M · float64: 2.42×sin · 100k · float64: 2.64×log10 · 10M · float64: 3.38×atan · 10M · float64: 3.56×pow · 1M · float64: 3.59×mod · 100k · float64: 3.63×sqrt · 10k · float64: 3.73×cbrt · 10M · float64: 3.74×log1p · 10M · float64: 3.92×pow · 10M · float64: 4.28×atan2 · 1M · float64: 4.86×sin · 10M · float64: 4.95×hypot · 1M · float64: 4.98×floordiv · 100k · float64: 7.67×mod · 10M · float64: 8.12×floordiv · 10M · float64: 9.77×sqrt · 1k · float64: 25.9×floor · 100 · float64: 151×

Select a dot, or focus the chart and use the arrow keys, to see a lane's timings and confidence interval.

Read the extremes with care

The fastest lane, df_transpose_materialize at 533×, reads one column of a lazy transpose; materializing the whole transpose is the slowest lane on the board, at 0.004×. floor on 100 rows (151×) mostly measures pandas' per-call overhead. The middle of the distribution is the better guide.

All rows come from one machine (AMD Ryzen Threadripper PRO 5975WX, 32 cores, Linux 6.17.0-41); the newest is dated 2026-09-09. The full method and every row are in SCORECARD.md.

The 10 certified losses

ratioworkloadsizecategorynote
0.004×df_transpose_full_materialize100kdataframe ops
0.005×df_transpose_full_materialize_positional100kdataframe ops
0.057×df_transpose_full_materialize10kdataframe ops
0.310×floor4Mmath unarystale binary
0.840×drop_duplicates100kdataframe opsstale binary
0.885×div1Mmath unarystale binary
0.895×expm1100kmath unarystale binary
0.900×sqrt10Mmath unary
0.942×log100kmath unary
0.948×log_int64100kmath unary

“Stale binary” means the lane has since run on a newer build and should be measured again before anyone acts on it. The scorecard names three structural floors: 2-D block storage for transpose, string-key groupby factorization, and the matrix-multiply microkernel.

06 · Safety and policy

No unsafe, and a rule for the unknown.

All 15 crates declare #![forbid(unsafe_code)], so the compiler refuses unsafe anywhere in the library; the vector kernels use Rust's portable std::simd, which is why the crate needs a nightly toolchain. At run time FrankenPandas works in one of two modes. Strict reproduces pandas, including behavior you may not want, such as the silent int64 wraparound in timedelta arithmetic. Hardened keeps pandas' answers wherever pandas defines one, adds bounded repairs, and writes down every decision.

Interactive · the constants from fp-runtime

Unknown input fails closed

When a caller asks for something the runtime does not recognize, strict mode rejects it outright. Hardened mode runs the same expected-loss calculation, and with the shipped constants it also rejects: the posterior that the request is safe comes out at about 0.18%.

Only reject stops an operation

An action of allow or repair lets the operation continue; repair is recorded as a deviation. A hardened join over its row cap is always admitted as repair and logged, so a cap bounds what you have to review rather than failing the pipeline.

A short, checked dependency tree

PostgreSQL support speaks the wire protocol without tokio, and ci_supply_chain_policy.rs fails if tokio, tokio-util or tokio-postgres enters Cargo.lock. ORC files are refused with an error until there is a reader that does not need it.

07 · Input and output

Reads and writes what pandas does.

CSV and TSV, fixed-width, JSON in five orients, JSON Lines, Parquet, Feather, Arrow IPC, Excel, SQL, HTML, XML, pickle, Stata, LaTeX and Markdown, with no Python involved. (One exception to compatibility: pickle output is FrankenPandas' own typed snapshot, not a pandas object, so it round-trips through FrankenPandas only.) The figure writes one frame in each format and reads it back with FrankenPandas' own readers. It needs a second, larger engine with the Arrow, Parquet and Excel code, so that engine downloads only when you ask for it.

Interactive · loads a second engine on request

SQL runs against SQLite by default, with MySQL and PostgreSQL behind cargo features; HDF5 is a feature too. ORC, SPSS and BigQuery are not implemented.

08 · Get started

Use it from Rust or Python.

FrankenPandas is pre-1.0 and changes quickly. The Rust crate is the complete library; the Python package is an alpha binding over it.

Rust

cargo add frankenpandas

Needs the nightly toolchain the repository pins (nightly-2026-08-31) for std::simd. Default features: SQLite and the lazy transpose view; PostgreSQL, MySQL, HDF5 and tracing are opt-in.

use frankenpandas::prelude::*;

let df = read_csv_str("city,age\nNYC,30\nLA,25\nNYC,35")?;
let adults = df.query("age > 28")?;
let summary = adults
    .groupby(&["city"])?
    .agg_named(&[("avg_age", "age", "mean"), ("count", "age", "count")])?;
println!("{summary}");

Python alpha

pip install frankenpandas

Prebuilt wheels for CPython 3.13 on Linux x86-64 and aarch64; other platforms build from the source distribution with the pinned nightly. The binding exposes pandas' top-level names and the DataFrame, Series and Index methods, checked by 1,311 differential tests. It is not yet a drop-in replacement, so test the operations you rely on before swapping an import.

import frankenpandas as pd

df = pd.read_csv("orders.csv")
df.groupby("region")["units"].sum()

A good fit

  • Rust code that needs pandas' semantics: label alignment, missing-value rules, groupby and merge as pandas defines them.
  • Checking a pandas pipeline against an independent implementation.
  • Workloads heavy on strings, joins, indexing and rolling windows, where the measured gains are largest.
  • Running pandas-style code in a browser or another WebAssembly host, as this page does.

Look elsewhere if

  • You need a stable API today; FrankenPandas is pre-1.0.
  • You need Python wheels for macOS or Windows without building from source.
  • Your data does not fit in memory, or you want a lazy query planner: Polars and DuckDB are built for that, and FrankenPandas is not.
  • Your code depends on pandas behavior the binding has not covered yet; the limitations table in the README lists what is missing.