Skip to main content

GPU-accelerated DataFrame library for Apple Silicon, built on MLX

Project description

MLX-DF

GPU-accelerated DataFrame library for Apple Silicon, built on MLX.

MLX-DF brings cuDF-style GPU DataFrame operations to Mac, exploiting Apple's unified memory for zero-copy CPU/GPU data sharing. The API mirrors Pandas for easy migration.

[!WARNING] MLX-DF currently supports only Apple Silicon devices (M-series chips).

Installation

pip install mlxdf

Using uv:

uv add mlxdf

With PyArrow/Parquet support:

pip install mlxdf[arrow]

Using uv:

uv add "mlxdf[arrow]"

From source:

uv sync
uv build

Quick Start

from mlxdf import MlxDataFrame, merge, read_parquet

# Create a DataFrame (string columns auto-detected as CategoricalSeries)
df = MlxDataFrame({
    "product_id": [1.0, 2.0, 1.0, 3.0, 2.0],
    "quantity":   [5.0, 3.0, 2.0, 7.0, 1.0],
    "category":   ["A", "B", "A", "C", "B"],
})

# Filter
high_qty = df[df["quantity"] > 2.0]

# Computed columns
df["double_qty"] = df["quantity"] * 2

# GroupBy aggregation
result = df.groupby("category")["quantity"].sum()
result.show()

# Join two DataFrames
prices = MlxDataFrame({
    "product_id": [1.0, 2.0, 3.0],
    "price":      [10.0, 25.0, 15.0],
})
joined = df.merge(prices, on="product_id", how="inner")

# Parquet I/O (requires mlx-df[arrow])
df.to_parquet("output.parquet")
df2 = read_parquet("output.parquet", columns=["product_id", "quantity"])

Features

  • MlxSeries — Column with boolean null mask, vectorized arithmetic, comparisons, and aggregations
  • CategoricalSeries — Dictionary-encoded string column (55× faster filtering vs Pandas)
  • MlxDataFrame — Dict-like table with column access, boolean filtering, head/tail/slicing
  • GroupBy — Bincount/sort-based groupby with sum/mean/count/max/min aggregations
  • Join — Hash-index join supporting inner/left/right/outer (4× faster vs Pandas at 200M rows)
  • Pandas Interopto_pandas() / from_pandas() with automatic type conversion
  • PyArrow & Parquet — Read/write Parquet with column pruning and predicate pushdown
  • JIT Compilationcompile_fn for fused GPU kernel execution

Development

Setup

uv sync

Running Tests

# Run all unit tests (benchmarks are excluded by default)
uv run pytest

# Run a specific test file
uv run pytest tests/test_series.py

# Run a specific test case
uv run pytest tests/test_series.py::TestArithmetic::test_add_series -v

# Run with verbose output
uv run pytest -v

# Run and stop on first failure
uv run pytest -x

Benchmarks

Benchmarks are integrated into pytest via the bench marker, defaulting to deselected so they don't slow down regular test runs.

# Run all benchmarks
uv run pytest -m bench

# Run a specific benchmark
uv run pytest -m bench -k parquet
uv run pytest -m bench -k tpch
uv run pytest -m bench -k categorical
uv run pytest -m bench -k compile

# Run both tests and benchmarks together
uv run pytest -m ""

# Run benchmark scripts directly (also works)
uv run python benchmarks/bench_vs_pandas.py

Available benchmarks: bench_vs_pandas, bench_categorical, bench_parquet, bench_compile_df, bench_tpch_q1/q3/q4/q6/q18/q19

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlxdf-0.1.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlxdf-0.1.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file mlxdf-0.1.0.tar.gz.

File metadata

  • Download URL: mlxdf-0.1.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlxdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6575809986b02b7835d6e0e790554a4d6cb2ba1050a6a9879e029005804f5b0b
MD5 161e1e3ca160095a37333ace9a8f2b11
BLAKE2b-256 f2d6cc0a6d0864d04cb3001ea5d67954ff05791df068c31a55de4230211726ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlxdf-0.1.0.tar.gz:

Publisher: release.yml on mocusez/mlxdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlxdf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlxdf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlxdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9761a6c1d56c56dbac2023d5e14a0c3f1c8e87ee89f26a34d155147f7104bfb2
MD5 7da2e7fb2a9e06dad75f2f05da977739
BLAKE2b-256 f0a80e889edb9a117179057ee410dc907a759389d2aaf8a84e02ff556067c724

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlxdf-0.1.0-py3-none-any.whl:

Publisher: release.yml on mocusez/mlxdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page