Skip to main content

arrow-dx

Helpers for the Arrow-backed Python stack: polars, pyarrow, duckdb. Small, theme-bound — each helper smooths a rough edge in day-to-day dataframe work, nothing more.

Install

pip install arrow-dx
# optional extras
pip install "arrow-dx[pandas]"
pip install "arrow-dx[pyarrow]"
pip install "arrow-dx[duckdb]"
pip install "arrow-dx[all]"

Requires Python 3.13+. Only polars is a hard runtime dependency.

Helpers

unify_schema(root, *, output_dir=None, type_overrides=None, on_conflict="supertype", column_order=None)

Rewrite every *.parquet under root to share one schema. Use case: a hive-partitioned dataset where files written at different times have drifted — a column added later, a type widened, a column missing in older files. After unification every reader (polars, pyarrow, duckdb, pandas) handles the dataset with its bare-minimum call.

from arrow_dx import unify_schema

# rewrite files in place
unify_schema("data/")

# or copy into a new tree, preserving the partition layout
unify_schema("data/", output_dir="data-unified/")
  • on_conflict ∈ {"supertype" (default), "string", "error"} — how to resolve a column whose type differs across files.
  • type_overrides={"col": pl.String} — pin specific columns; wins over conflict resolution.
  • column_order=[...] — pin a column-order prefix; remaining columns follow in first-seen order.
  • Hive key=value partition columns are auto-detected and excluded from the file schema.

sample_print(df, n=10, seed=None)

Print n contiguous rows from a random offset in a sorted polars, pandas, or pyarrow dataframe. Defeats each engine's default row-clipping so the full window is visible. Caller is responsible for sorting first — the slice is contiguous, so it's only meaningful in some intentional order. pyarrow Dataset (lazy) is out of scope; call .to_table() first.

from arrow_dx import sample_print

sample_print(polars_df,    n=10, seed=42)
sample_print(pandas_df,    n=10, seed=42)
sample_print(pyarrow_table, n=10, seed=42)

summarize(t, *, group_by=None, con=None)

Per-column summary statistics for a parquet dataset (or any duckdb-readable thing). Returns one row per column: column_name, column_type, min, max, n_unique, avg, std, q25, q50, q75, count, null_perc. Numeric stats are formatted to 4 significant figures and decimal-aligned for compact display. min/max are nulled for VARCHAR columns (lexical bounds rarely meaningful); DATE columns keep YYYY-MM-DD format in aggregates. Quantiles are exact (duckdb spills to disk if needed) and the underlying SUMMARIZE runs streaming, so 100M-row datasets don't materialize.

from arrow_dx import summarize

summarize("data/**/*.parquet")
summarize("data/**/*.parquet", group_by="region")  # column-major: each column across regions
summarize("orders", con=my_con)                    # use a registered table

t is a catalog table/view name, parquet file path, or parquet glob. group_by runs a separate SUMMARIZE per distinct value — fast for low-cardinality columns (regions, years), slow for high-cardinality ones (user_id, sku). To summarize an in-memory polars DataFrame, register it on a connection first: con.register("df", my_df); summarize("df", con=con).

Requires the duckdb extra: pip install "arrow-dx[duckdb]".

DuckDB

sample_print is also shipped as a duckdb SQL macro. To install it for the duckdb CLI:

uvx arrow-dx duckdb-macros >> ~/.duckdbrc

Then in any CLI session:

SELECT * FROM sample_print('orders', 10);                    -- catalog table
SELECT * FROM sample_print('s3://bucket/data.parquet', 10);  -- single file
SELECT * FROM sample_print('data/**/*.parquet', 10, seed := 42);  -- glob, deterministic

The argument is a string — a catalog table/view name, a parquet file path, or a parquet glob ('dir/**/*.parquet'). Caller still owns sort order. With seed := <int> the offset is deterministic; without it, a fresh random offset each call. The duckdb CLI's row-clip is .maxrows N in your ~/.duckdbrc, separate from the macro.

For Python users with an open connection:

import duckdb
from arrow_dx.duckdb import install_macros

con = duckdb.connect()
install_macros(con)
con.sql("SELECT * FROM sample_print('mytable', 10, seed := 42)")

Reports

arrow_dx.report.markdown(t) renders a one-page markdown report — header (path, rows, size, partition count), schema (arrow / polars / duckdb types side-by-side + null %), summary (per-column min/max/avg/std/quartiles via duckdb's SUMMARIZE, plus an inline sparkline for numeric columns), hive-partition breakdown, and a contiguous-window sample.

from arrow_dx import markdown

# print to stdout
print(markdown("data/**/*.parquet"))

# write to a file alongside the data
markdown("data/**/*.parquet", output="data/REPORT.md", sample_n=20, sample_seed=1)

Options:

  • style="markdown" (default) renders pipe-and-dash tables that markdown viewers turn into styled tables; style="box" switches to Unicode box-drawing tables (┌─┬─┐) wrapped in code fences for monospace contexts (terminals, plain-text files). Sparklines and histograms always use Unicode block characters.
  • per_partition=True adds a Per-partition summary section faceted by the leftmost hive column (low-cardinality only — runs one SUMMARIZE per group).
  • sparklines=True (default) adds a sparkline column to the Summary table for numeric columns, showing the per-column distribution in 10 buckets via Unicode block chars (▁▂▃▄▅▆▇█).
  • histograms=True (opt-in) adds a Histograms section with full bar-chart per numeric column — bin edges, bar, count.

Drop-in for code review, dataset onboarding, or living docs alongside the data. Deterministic sample seed by default so re-running on unchanged data produces a stable diff.

Requires the duckdb extra: pip install "arrow-dx[duckdb]".

Scope

In: ergonomics for the Arrow-backed dataframe stack — polars, pyarrow, duckdb (+ pandas as an extra). Out: anything that doesn't fit that theme. The discipline keeps this from rotting into a junk drawer.

Metadata

Release files for arrow-dx 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arrow-dx 0.1.2
File Size Uploaded Provenance Actions
arrow_dx-0.1.2.tar.gz 42.7 kB With provenance Details for arrow_dx-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arrow-dx 0.1.2
File Interpreter ABI Platform Actions
arrow_dx-0.1.2-py3-none-any.whl Python 3 none any Details for arrow_dx-0.1.2-py3-none-any.whl

Total release size: 61.2 kB

Release files / arrow_dx-0.1.2.tar.gz

Download URL arrow_dx-0.1.2.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bcaa8303a65375595e148c2f98a103c2ec0920ff9354578295ee41bb10d97aff
BLAKE2b-256 checksum
How to use checksums
846a64ed80514ac096a71374d71edf848c1a11828b9ffc3162d1d413ec9967e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Release files / arrow_dx-0.1.2-py3-none-any.whl

Download URL arrow_dx-0.1.2-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da006790a69958d1dd9540197c2bc486b8f14d9e9fef3ccaf3c7439d5ae150b6
BLAKE2b-256 checksum
How to use checksums
1096f0ad3659d96768dfcc091dd295bf8e6538b145fb79732df6247f80af903f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

Security for arrow-dx 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for arrow_dx-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page