Skip to main content

Strongly-typed DataFrames for Python, powered by Rust.

Project description

PydanTable

CI Documentation PyPI version Python versions License: MIT

Typed dataframe transformations for FastAPI and Pydantic services, backed by a Rust execution core.

Current release: 0.10.0 · Python 3.10+


Documentation

The full manual lives on Read the Docs:

https://pydantable.readthedocs.io/en/latest/

That site is the supported entry point for concepts, contracts, API notes, and examples. The sections below point to the same pages so you can jump straight from GitHub.

Topic Read the Docs
Home / overview Documentation home
DataFrameModel contract (inputs, transforms, collisions, materialization) DataFrameModel (SQLModel-like)
Column types (scalars, structs, list[T], nullability, unsupported cases) Supported data types
FastAPI (routers, bodies, collect, responses) FastAPI integration
Execution model (collect, to_dict, to_polars, optional Python Polars, UI modules) Execution (Rust engine)
Semantics (nulls, joins, ordering, reshaping, windows — Polars-style contract) Interface contract
Roadmap (0.5.0–0.10.0 shipped, path to v1.0.0) Roadmap
Why not use Polars directly? Why not just use Polars?
Pandas-style imports (pydantable.pandas) Pandas UI
PySpark-style imports (pydantable.pyspark) PySpark UI
PySpark helpers & parity PySpark interface · PySpark API parity
Polars parity (scorecard, workflows, transformation roadmap) Parity scorecard · Polars-style workflows · Transformation parity roadmap
Contributors (build, test, benchmarks, releases) Developer guide
Plan / vision (architecture phasing) Plan document
Python API reference (autodoc) API reference

For copy-paste convenience, the site base URL is:

https://pydantable.readthedocs.io/en/latest/


What PydanTable does

PydanTable keeps Pydantic models as the source of truth for:

  • column types and nullability (Optional[T] / T | None)
  • typed expressions — invalid combinations fail when the expression is built (Rust AST), not only at runtime
  • schema evolution — chained transforms produce new model types with stable rules (e.g. with_columns name collisions)

The default API feels Polars-like; optional pydantable.pandas and pydantable.pyspark modules only change naming and imports — execution is always the native core. Details: Execution, Interface contract.

Expression surface (current release, Rust-typed Expr):

  • Globals in select: global_sum, global_mean, global_count, global_min, global_max, and global_row_count() (row count / COUNT(*)). PySpark: F.count() with no argument for row count; F.count(F.col(...)) for non-null column count.
  • Windows: row_number, rank, dense_rank, window_sum, window_mean, window_min, window_max, lag, lead with Window.partitionBy(...).orderBy(...) / .spec(), plus framed windows (rowsBetween, rangeBetween) for supported operations.
  • Temporal: strptime, unix_timestamp, cast from strdate / datetime (Polars parsing; use strptime for fixed formats), dt_* parts, dt_nanosecond on datetime / time.
  • Maps / binary: map_len, map_get, map_contains_key, binary_len, including nested JSON-like map value dtypes with string keys.
  • Map utilities: map_keys(), map_values(), and map_entries() for per-row key/value extraction on dict[str, T] columns.

PySpark-named helpers live under pydantable.pyspark.sql.functions. Details: Supported types, Interface contract, CHANGELOG.


Install

pip install pydantable

Optional Python Polars (for to_polars() only):

pip install 'pydantable[polars]'

From a git checkout, the Rust extension must be built (e.g. with maturin):

pip install .

See Developer guide — local setup for maturin develop, release builds, and CI parity.


Quick start

from pydantable import DataFrameModel

class User(DataFrameModel):
    id: int
    age: int | None

df = User({"id": [1, 2], "age": [20, None]})
df2 = df.with_columns(age2=df.age * 2)
df3 = df2.select("id", "age2")
df4 = df3.filter(df3.age2 > 10)

print(df4.to_dict())

Example output:

{'age2': [40], 'id': [1]}
  • Materialization: collect() returns a list of Pydantic row models; to_dict() returns columnar dict[str, list].

  • Alternate UIs:

    from pydantable.pandas import DataFrameModel as PandasDataFrameModel
    from pydantable.pyspark import DataFrameModel as PySparkDataFrameModel
    from pydantable import DataFrameModel as DefaultDataFrameModel
    

More examples: FastAPI integration, Polars-style workflows.

Input quality policy (optional): constructors are strict by default, and can be switched to best-effort ingestion with ignore_errors=True plus on_validation_errors=... to receive failed rows (row_index, row, validation errors). See DataFrameModel docs.


Development

make check-full   # Ruff, mypy, Rust fmt/clippy/tests (see Makefile for `rust-test` env)
pytest -q         # or: pytest -n auto  with the [dev] extra

Rust + Python: see Developer guide (formatting, maturin, make rust-test for cargo test with the venv PYTHONPATH, benchmarks, contribution workflow).


License

MIT

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

pydantable-0.10.0.tar.gz (129.7 kB view details)

Uploaded Source

Built Distributions

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

pydantable-0.10.0-cp313-cp313-win_arm64.whl (16.7 MB view details)

Uploaded CPython 3.13Windows ARM64

pydantable-0.10.0-cp313-cp313-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydantable-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydantable-0.10.0-cp312-cp312-win_amd64.whl (18.4 MB view details)

Uploaded CPython 3.12Windows x86-64

pydantable-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl (16.8 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pydantable-0.10.0-cp312-cp312-musllinux_1_2_aarch64.whl (15.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pydantable-0.10.0-cp312-cp312-manylinux_2_28_aarch64.whl (15.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

pydantable-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydantable-0.10.0-cp312-cp312-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydantable-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydantable-0.10.0-cp311-cp311-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl (16.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file pydantable-0.10.0.tar.gz.

File metadata

  • Download URL: pydantable-0.10.0.tar.gz
  • Upload date:
  • Size: 129.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for pydantable-0.10.0.tar.gz
Algorithm Hash digest
SHA256 edb3aa6ac6b7aa687729b09a266bd29d5f02af2ea1e17767a852921d87e5e6e5
MD5 2a59e130276877e53c89827ed00cf2a8
BLAKE2b-256 1f539c9c8a4a675384f3c7f9c2a849c1dda0ebf97310e0fdb138768f92fae1f8

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp313-cp313-win_arm64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 ed7fda2db64bb76200d7003e8ae47852b42452465813237aa162d93dd079b8fb
MD5 0309923db00fa2b9337c564231105d2a
BLAKE2b-256 26ddf4ee8c289c22acf37417eea982e2ad9137aa3bfffbc1cb60d6baf843302b

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91af81397110477339bb4b552e15a98defde542aefa4213785e2e79f11c56876
MD5 a52b9792a82172c5bf31d2625645f966
BLAKE2b-256 9dd58bc78c978e9a8af830a2b6638771845d3db9b00987f50e1be176e215c081

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b407fcfb3aff3abd15fc91fea2b0d21cd316f85a2b919867128b6eac61587ffd
MD5 446dea31e9789862014eebcee4113d71
BLAKE2b-256 35b0c824573544ec9d057c988a140ac8a46559536f02aa2afc42c60894543312

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 080135d006ffd36a27a394481d566792c58493d2be06e44067cba5e28395a881
MD5 39c9691b08c7449b071d7edb36f3a724
BLAKE2b-256 c278e06264accc8bc33997da91b3e6474682a19fdfed3d1f20aad8465a36011d

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bbad8da7fc8bb989aa15473e3e31d73ff8eadfd6c50a7247d2f5d6a8eba8e2f4
MD5 ee6c4ca83a8cd9c8fe6cd1290fa55717
BLAKE2b-256 3e81df46d0d783bd742d8737749bb09c70e5b5cb3f60f02125b65712551d1edd

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d7f36a32a3240ca5db0bb441c7d9ebe10ea12eb9a32bd7555fc4c7f42335f1c1
MD5 f8710cf4fe532dc7ee2294975ca43e4d
BLAKE2b-256 6de2410bb37a3057a8e3c540be6c9b2d3a64ca9c2e04dbcfe6b5687b3ca5c175

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 22117d407b701064944f7d51dee9ced6f71a1f64038076bd30a01468e1787a70
MD5 8942be251818dd9a7839583cc3b1d331
BLAKE2b-256 9d162055e1f95cb308cd5fa35ff701cdfb9e17898e9a9d6531a3a44d26ace760

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c9c8030512631965df7ec2c5c31cc2871f82bcd33ba32edf245867a0b15b667
MD5 efca56aa37c48b2d8c69d4e11ac5d735
BLAKE2b-256 4e11a806c10646080c497cdb235ec2de88ba068b7399fda3ed29530603205e13

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01e33353532c357f1fd9e6820ef542c0ebc24a83a8cd5d43bf581fc6420cc35a
MD5 430e53fee27764768fbfe16b0a5b1373
BLAKE2b-256 907904249d0b625ec4aa1380282758e5769d719c7ed3e72048a43d5a01a6e5f4

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 23c184ba551d21566c10bd264a5975af2caa616efd66b3a9677dfadc689382e4
MD5 a46ea082a925ae44747d9ec408608887
BLAKE2b-256 117344b3621cc47a26174d03102e0ed749430e29e3c85592d77101d3e9e05a09

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d6fa35b28f41e91f8ae51e0a781431ed6ff2de17b8e4543afdc638d269063b6
MD5 a157717bc07af46607426d256c8b9a06
BLAKE2b-256 638b10e88fe69493030f8c614c6061bed1572a95ea5ccfd3454cb5e723c7718d

See more details on using hashes here.

File details

Details for the file pydantable-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 068e12960570c50ea4b816ada4f6e96c0b2ca75bb605d7820adcc5cf65d4e301
MD5 dffbbbda90bb5e91694cf21390004eff
BLAKE2b-256 48eba2eb756d93360137a70404a7247ce61ca585c772928315eec56f18458db8

See more details on using hashes here.

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