Skip to main content

Helpers for the Arrow-backed Python stack: polars, pyarrow, duckdb.

Project description

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[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 df, with pl.Config(tbl_rows=n) so polars' default row-clipping doesn't truncate the window. Caller is responsible for sorting first — the slice is contiguous, so it's only meaningful in some intentional order.

from arrow_dx import sample_print

sample_print(sorted_df, n=10, seed=42)

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.

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

arrow_dx-0.1.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

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

arrow_dx-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for arrow_dx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8ad24b99e4749de23bb0c83a9ede9cf325f783712eb7ce76b8cca439e0952fc
MD5 cb99289e4715523d7958fb0b33bc34c3
BLAKE2b-256 a25aebb56808c611e775c23a43dd24f4e1047582c6d8feae3059dc405f4dddcf

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on twedl/arrow-dx

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

File details

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

File metadata

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

File hashes

Hashes for arrow_dx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a10e73c1b4fbd676e18a8cc02740ba72e877a4bcd4802371f5ab1d9b03749de8
MD5 f656f31ca4984d6b89f2600dcde8337e
BLAKE2b-256 07a687dc94d700ff1db9adf97cdc60e2b9c8d45c7876d796a24c3f8bcf3b6b69

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on twedl/arrow-dx

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