Skip to main content

Strongly-typed DataFrames for Python, powered by Rust.

Project description

PydanTable

CI Documentation PyPI version Python versions License: MIT

Strongly typed DataFrames for Python, powered by Rust.

PydanTable combines Pydantic schemas with a Polars-backed Rust execution engine to provide a typed, service-friendly DataFrame API (with optional integrations for FastAPI, SQL, MongoDB, Spark, and more).

Current release: 1.19.1 — highlights in the changelog.

Documentation

What you get

  • Typed tables via Pydantic models: DataFrameModel or DataFrame[Schema]
  • Typed expressions + lazy plans validated/lowered in Rust
  • Explicit materialization: collect() (rows) or to_dict() (columns), plus optional Arrow/Polars exports
  • File / HTTP / SQL I/O helpers and integration patterns for services

Key references:

Install

pip install pydantable

Optional extras:

pip install "pydantable[polars]"   # to_polars
pip install "pydantable[arrow]"    # to_arrow / Arrow constructors
pip install "pydantable[io]"       # full file I/O convenience (arrow + polars)
pip install "pydantable[sql]"      # SQLModel + SQLAlchemy + moltres-core lazy SqlDataFrame; add a DB-API driver for your URL
pip install "pydantable[pandas]"   # pandas-flavored façade (pandas UI doc)
pip install "pydantable[fastapi]"  # FastAPI integration (pydantable.fastapi)
pip install "pydantable[mongo]"    # pymongo + Beanie + Mongo plan stack (lazy MongoDataFrame + I/O + from_beanie)
pip install "pydantable[spark]"    # SparkDataFrame / SparkDataFrameModel (raikou-core + pyspark + sparkdantic)

Quick start

from pydantable import DataFrameModel

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

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

print(result.to_dict())
print([r.model_dump() for r in result.collect()])

Output (one run):

{'id': [1], 'age2': [40]}
[{'id': 1, 'age2': 40}]

Next steps

Development

Use a virtual environment at .venv in the repo root (the Makefile defaults to .venv/bin/python). Full contributor setup, native builds, and contributor notes: Project → Developer.

make check-full      # ruff, ty, pyright, typing snippet tests, MkDocs, Rust

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-1.19.1.tar.gz (218.2 kB view details)

Uploaded Source

Built Distribution

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

pydantable-1.19.1-py3-none-any.whl (254.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydantable-1.19.1.tar.gz
  • Upload date:
  • Size: 218.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.13

File hashes

Hashes for pydantable-1.19.1.tar.gz
Algorithm Hash digest
SHA256 6cc43fd1e94e7599ed576103c2818b6c8bd41715d64e86f8c6f53e2e1ca0a1d6
MD5 4767fcfe6f66a8e0e61ee3476f214d6d
BLAKE2b-256 747974defbe88c83b6aed27cfe35ca29ff5752f057427ce3fc39b2fedf9e5d56

See more details on using hashes here.

File details

Details for the file pydantable-1.19.1-py3-none-any.whl.

File metadata

  • Download URL: pydantable-1.19.1-py3-none-any.whl
  • Upload date:
  • Size: 254.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.13

File hashes

Hashes for pydantable-1.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1eec42a3e140c14276c1ae73468c06aa6de83930d0f4f75f76027e5bc2164684
MD5 eb7673c9978d7a6af0bd124ffa56ec42
BLAKE2b-256 e670f670166d275e26f1b2057e9fc8ee57dac3e6ce958a87338e9a593bdf7361

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