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.8.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.8.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().
  • 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.

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.


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.8.0.tar.gz (123.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.8.0-cp313-cp313-win_arm64.whl (16.7 MB view details)

Uploaded CPython 3.13Windows ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

pydantable-0.8.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.8.0-cp312-cp312-musllinux_1_2_aarch64.whl (15.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

pydantable-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-0.8.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.8.0.tar.gz.

File metadata

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

File hashes

Hashes for pydantable-0.8.0.tar.gz
Algorithm Hash digest
SHA256 c2ece9564916c48275e2df27616f490a3435ddd1dd0a073df73b950361a6a64d
MD5 b9fde51402b1f175a6f46ab9cd6be04b
BLAKE2b-256 0ee82421baddc56a8e36da2b69b2889908fd655b929f8c591d1478ff73a19927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 fd6cc436ebaf64d2e42753f9e22030d1504c2791a7c0038b5da1c358d5bfac3d
MD5 355be357afff565ae11371f0d02c57a4
BLAKE2b-256 fa1fd818d34e6057c5670817ea980c605318a16366b359b6059be83feff6dbe9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7f33b81131796784d3503b2054fc221065e5e7e6649611d311adc3a390d23af
MD5 927c30d7af0069271850d0c287ec3c4d
BLAKE2b-256 4fddbf137ab4693ea313e74ef2b0578a94ee7fcc9cdeba7458061cbeb2f52bba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 343fc7227bab74f4e7eb02d3e532680ef89c28d8e2f72535950d4c763aa0c1ee
MD5 fc27178c57fad1ebfd4eeb3a0fcb86e6
BLAKE2b-256 dfc82e812d7fca9540cb5029e9ac3eb91671876f6f23200e0be24834c0b7f709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e9d931c929d59d54b4ca34aa2c631c77048e4edc23132afcb5d2079d2819737c
MD5 9eecfe8580ca48eb48031b78c7b462c5
BLAKE2b-256 ae4e665efdbda54d2dabf0f9c5b9175164d9b1b683626bbd26714bd272dc93d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 21aae869b77329a39dfa523e68e0042bebe58f4aa273c4c60e563ba9946b1835
MD5 a1460afeceeba4ed8e0cffc9b1236430
BLAKE2b-256 4fe5eeebe83dd71998e608f9e619ba51c8ae520750a3c0a4d14d05374004dafe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 34a83c9199f5bb39d133638d55a190c63643352e7f1defcc323c227054444f27
MD5 c7612b4a95be7915cf1f5e74014f0e6e
BLAKE2b-256 f329d3bbe4f1313eeb7dc6c99f41f62eb48cc489c72d82c60b5dcdda3188c162

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2c23d6c6497d1d029a842f91d2f83ceaf19c9fd35c7e44288965e1b32d307597
MD5 4ff3b612a2621a2d906df6e9a446ddfd
BLAKE2b-256 662d0cb0f39245af281aa3afb242bfeb495b812b6b68aee09db7bf7284d3df86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ffa503b02c57dd2f0150d93d3377034ae8bdbeedb4a28f91e359257da4482b26
MD5 5299a393ade83f57544a9c4a45983304
BLAKE2b-256 fe5a4e4b6b1fe52d6f1c5f8f83ec23f900b4c9a32fe024001bab4869238e1020

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc124230768d5c68a0c80183559791c2de4b842bcdf740cdf862aa20b1b9a196
MD5 f0a54e59cb637c98e38f0e80048594c2
BLAKE2b-256 7fddf54c463af1b9fb671d9c6db3a31a98ecbef956c8ff35d9e1c32a1403ea6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e008055dc129fd73104425af0591df5e4726675c9e4ea8aa8f0930d9be5c51b7
MD5 6f8b202be2376b857c1a8a64d73cd47c
BLAKE2b-256 6ac305d7ac6edb7082177aedf5993e2fabae20bbb83d3724562a0005529daa15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67dd0052c427827cc5681d2d3b13807839b53787acb860918e3281f92b25d3e0
MD5 4b2fd002ee8d54542f79be6186415f0b
BLAKE2b-256 d2f5a014b0b8b6307b136dbc69a15122253c637b534f0a64b39d96c90d60247b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 59455dfa5c36f5601f10ac03ee4ad93765a7e144e4c5cf32fa62d5de8b41ab05
MD5 60facf81af271acd136d7fad2df2f633
BLAKE2b-256 d9e068022fbeef0f63e9c3c776a8c68b12b8590145ea6065cad2c85b5dec9841

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