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.13.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.13.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.13.0 ships stabilization docs, roadmap realignment, and the combined scope formerly tracked as Remaining in 0.13.x—FastAPI trust boundaries for bulk/Polars/Arrow, window null/CURRENT ROW contract docs, strict PyArrow dtype checks (and correct handling of all Arrow array types in trusted buffers), framed-window and trusted-Polars benchmark scripts, plus pyarrow in dev/CI for tests. See changelog and Roadmap.

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(), map_entries(), and map_from_entries() for per-row key/value extraction and reconstruction 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.13.0.tar.gz (133.3 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.13.0-cp313-cp313-win_arm64.whl (16.7 MB view details)

Uploaded CPython 3.13Windows ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-0.13.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.13.0.tar.gz.

File metadata

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

File hashes

Hashes for pydantable-0.13.0.tar.gz
Algorithm Hash digest
SHA256 fdc4549ba5ad08f22b79268d4219e8c18c4107ab56e74c6de49982a66d593fbe
MD5 42b4a90c01dedc7207961f8ead56a0e1
BLAKE2b-256 649f3d88961fbbb5b24652cd93d42d63c217117560cb6f425487f7363002448e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 6230377e4f756562c40adad09549b7ebdb21e30f8a7ae0e6b2fa9797e71c3374
MD5 be6ce49666db59af060ffcd2c0186a8e
BLAKE2b-256 b36ce796afd316515fecf2677b13f91b5304e6d6583364c822426b71712e8a6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9026c96a230d4c2cecc950b31c07486f4c589e0a0076093d8dade1568539d5a
MD5 b9c0d3c798d86556579598c888850d7e
BLAKE2b-256 b7dcc104d2f39ffd940ff908669de43c6765f8619ab333651a7ff897c7ec0a3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1377bb88aaa943847cb85ad6d7e7f3647fadc139aa8ba14e7cd010e5c667d21c
MD5 3358514e2daa19012480d98f02efc4e3
BLAKE2b-256 1ffb456f3c558cb3398730a60da481eeda81389f002ec292292c173bd83808fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 29c9b774c2691adc1ed7fcc53b0edc39dab0cfea70a104b12288471050d66f49
MD5 348cb111210f76e22c65bae0a2a3a352
BLAKE2b-256 c476475770372c1853c302dd82770e75e4c06ce450172e85627062a11023bedc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9c09fac78a91bdc62baccc35491b9ac7e9c863e8f6f104317080528d09fadb23
MD5 5026f2f01676861bc83cadbde1e27032
BLAKE2b-256 0278c8e9b6974b81eeacb889849c019dea8e523bb7ed55e6f60a212d47f1df3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 84cfff40a44d2d97314260663ac9721b708bb1bada5852eab2ed1977a41e16a4
MD5 558ab37af7e802c604eca80cb6df6d4b
BLAKE2b-256 9a638ae07cf2382efe27ce22e6b0d344225153e53645a1525abc21a97eb79396

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4ecc6127f2c23eae3cc3f832c2adfd28a2abd32a7692c80377d0ef3b55ba33b6
MD5 9f9b1feeba306af51ac6ecac619d9870
BLAKE2b-256 98b261b1ac3579886c30d4b0638eca97bf1ec87656f94e6158614e28be910b27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25a321765d1bbdea4a010ec0889d114288f81cd8debee1972284af3ed7a54558
MD5 e6fa126adab63b474b4df3a9e0752049
BLAKE2b-256 2b9993841fc6fe17db17aff352be4a5e11a8700bbccc3448efc030de7591471d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3232fe484c2fd5b9d1e0c4a23978cb7f1b5c0039a96043ba0d087d0eea363cf6
MD5 40dc5f240daf63aee6bab6bb56504e2a
BLAKE2b-256 dfb6b60929bbcef66829a3ed149afece47435f7c0a645751a2891d71dc1319a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2c9687fe3f0220b2c48c669d738ea1c0b9921dbb9251d18a47a796db03ed2935
MD5 e783388060de8f3331eece93d5103ed6
BLAKE2b-256 044fba02a0161f8dff860525b3cafd518d94504e8d391cc44ca01e15b27cd855

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09dbea79ee8ffeb96833611b7d162c76180ff9ce4705079e8367d830e9bcbbd2
MD5 f90a2c51ef5a5ac5656288c66bf94c61
BLAKE2b-256 be9c89bcacc2bdec2db0fc49d5a30d8de45339278dce9e853ca73041cdb66232

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-0.13.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fef031cda9702d28473218f818ad1c0500af2078a568d836f9706b4dbc844769
MD5 67ec75379375aa3dcc45e5c0f658ce75
BLAKE2b-256 b63dda48065671d574b7e464e80f12c32e0a493a68266700c85133edac12c062

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