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.7.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.7.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.

0.7.0+ expression surface (Rust-typed Expr): whole-frame global_* aggregates (sum, mean, count, min, max), window lag / lead (with Window.partitionBy(...).orderBy(...)), temporal helpers (strptime, unix_timestamp, dt_nanosecond), map entry count (map_len), and binary byte length (binary_len). PySpark-named wrappers live under pydantable.pyspark.sql.functions. See 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.7.0.tar.gz (118.4 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.7.0-cp313-cp313-win_arm64.whl (16.7 MB view details)

Uploaded CPython 3.13Windows ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

pydantable-0.7.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.7.0-cp312-cp312-macosx_11_0_arm64.whl (14.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-0.7.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.7.0.tar.gz.

File metadata

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

File hashes

Hashes for pydantable-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b4d8ff46e0190ce4aa80034efc3e655ba5824e5048136ed1ce33ca27ca80102d
MD5 fc9b22a109f286196deab4d0d63e1c9c
BLAKE2b-256 9c736c6efae3b69c3cf993cb157f4e6b210a280fc123525b990bf43f2ace6222

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 b21acd582769b3e734c8926c63111fbf29487d8b75fef34406253be5e6614ea9
MD5 c56c1ae9c5ba684e968601887e452ab9
BLAKE2b-256 efb7afb4c2664d2b665bb9745f6a935c28d0e6f26999bf4a320abdeb71f9edcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d261c574e84f366004eab8a24a1e54ddb1e8e2437e55539f9ef89e69262b5ccd
MD5 440c70ccd97ec606b4a8f3e77c4ef557
BLAKE2b-256 1cfb0d76dbc40144c1edaf62d61924ecd34602e5ada9bfd72e7ef37088744384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 46a7e385c10cdad5de8bf9fb8e419361dd8f9d5621dd9a8962697d9985159768
MD5 58188b44a665a765c8c8488bc9774dd7
BLAKE2b-256 6af739975386d65cf1f5827f181401075fd7e29400b87508d00e9fa60106547c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bd6a612744f86a72daf0c7369889ef3c71a5759d99eeb28d7040b179f35bf9cf
MD5 1a97b94f8eed2f9c1b393a9094e3c13b
BLAKE2b-256 ccc14157397a7d01739d72c41dbcddfc4d737e67736076bb9665580ba3f50a9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 844cd1a07822b85808afe9a271a50c98b76197ec788f0554281ca6a09b7f1844
MD5 cc3b8ba09a4c2b4664b755ac5be27cfc
BLAKE2b-256 56072c9469c2d9c2d1a4b45143559edd460ec52fe6c369f35060aa00f4dd71b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c40629f91d32b12763f8a5ececeb21b40bfe97550d85ffb776fe9816ca82a84c
MD5 53c5028abbb82f978ba990b991c9fd72
BLAKE2b-256 ba43397a1fdc35bea9bc38579beac6dd86d96b31d4c51d0c4af92dc3c4dec571

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 10484900b3c7a987b618cb5490114d5d82366f51bc6818dfcc441342ec017112
MD5 909a40252b79d0339bedc61de6585e1c
BLAKE2b-256 561119f53592b5eb746dac03774264c138a064a316a3a7c2cd179fa0c9ff8275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8056bd927e46ba99166f4b6010b1d52d894954404becfa8f86cfa3c025541908
MD5 a129e8916ece2913e69b1a70b45705f7
BLAKE2b-256 e3a7476d4f6c833d21916523fb606b798d9a8188ae2507470321633709662d7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61c773e1f1aea6726459f37a525cf7f8d02eec3e397b2e956d313f6341e9cad7
MD5 1f69c23fa972fd38baa12e3f95ace955
BLAKE2b-256 a05867c50b589290ec0d6ccbca0a1814840a4f0242e8b582df950da741910e80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a34aaca46b05c9f0a23166369c83452ccc1d5b7039280aa6b5c836e1e993c2cf
MD5 a558a5d3bd2f21c2211af2530a76b6f4
BLAKE2b-256 600bcd43600ee36f802887086715d1eea2a61dcb53b85e260db571fc5347473a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff3011d1bb9ded583d9c15401c46023e1506ffb252548562e0a6dac476f304ed
MD5 e2846a301a3a94eed6bd65e70bb1b1aa
BLAKE2b-256 b8cf34f0764f0883cd68791475035caf2fce81419864fe0bf6049411a510f468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c6e06bed9a41e71fc199e6def73be946148480e930683b9eea83007de617f749
MD5 b8c4892b0f855b6098c9c03b629ab71e
BLAKE2b-256 107eab2259ac187e117cfdf12f58ec0560139e91e784074816110014e12a47ba

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