narwhals-datafusion 0.2.0


pip install narwhals-datafusion

  Latest version

Released: Nov 07, 2026

Project Links

Meta
Requires Python: >=3.10

Classifiers

Development Status
  • 4 - Beta

Programming Language
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

narwhals-datafusion

CI compat PyPI version PEP 740 Downloads

Apache DataFusion backend for Narwhals, registered through the narwhals.plugins entry point.

pip install narwhals-datafusion                    # core
pip install "narwhals-datafusion[extra-functions]" # + mode, skew, kurtosis

Usage

import narwhals as nw
import pyarrow as pa
from datafusion import SessionContext

ctx = SessionContext()
df = ctx.from_arrow(pa.table({"a": [1, 2, 3], "b": ["x", "y", "x"]}))

lf = nw.from_native(df)  # nw.LazyFrame on this backend
result = (
    lf.group_by("b")
    .agg(nw.col("a").sum())
    .sort("b")
    .collect(backend="pyarrow")
)

Everything is lazy until .collect(): expressions become datafusion.Expr, frame verbs become datafusion.DataFrame methods, and DataFusion executes the plan. Dtypes are pyarrow end-to-end.

Used by

  • pandera: pip install 'pandera[datafusion]' validates datafusion.DataFrame through this plugin. tests/pandera/ pins the narwhals.stable.v1 calls it makes.

Compatibility

  • Python >=3.10; tested on 3.12.
  • datafusion>=55,<56: capped at the tested major; a release moves the cap.
  • narwhals>=2.27: floor only; tested on 2.28, the narwhals/ submodule.
  • datafusion-extra-functions >=0.5.5 (extra): each release pins its datafusion major.
  • Weekly, compat.yml (the badge): both suites on the newest narwhals release inside the datafusion cap, extra included.
Extras:
Dependencies:
datafusion (<56,>=55)
narwhals (>=2.27)
pyarrow (>=14.0.0)