Skip to main content

pandas backend adapter for PlanFrame.

Project description

planframe-pandas

Docs PyPI License: MIT

pandas adapter package for PlanFrame. Import as planframe_pandas.

Documentation (ReadTheDocs):

  • pandas track (end users): https://planframe.readthedocs.io/en/latest/planframe_pandas/
  • Light API reference: https://planframe.readthedocs.io/en/latest/planframe_pandas/reference/api/

Install

pip install planframe-pandas

Usage

from planframe_pandas import PandasFrame


class User(PandasFrame):
    id: int
    age: int


pf = User([{"id": 1, "age": 10}, {"id": 2, "age": 20}])
rows = pf.select("id").to_dicts()

Notes

  • Core v1.2.0+ (planframe, current minor v1.3.x): shared helpers include execute_plan_async, planframe.materialize, Expr operator IR, Frame *_async aliases, and v1.3.0 adapter/typing notes—see Migrating since v1.1.0.
  • PandasFrame subclasses core planframe.pandas.PandasLikeFrame, so you get pandas-flavored helpers (assign, sort_values, boolean indexing, column filter, astype, eval, drop_duplicates, …) on top of the shared Frame plan. See the pandas-like API guide.
  • PlanFrame is always lazy: chaining does not touch backend data; execution happens at collect() boundaries.
  • collect() returns list[pydantic.BaseModel]. Use collect_backend() for a pandas.DataFrame, or stream_dicts() / stream() to iterate rows (see Streaming rows).

Common transforms

  • with_row_index(name="row_nr", offset=0): add a monotonically increasing row number column.
  • clip(lower=..., upper=..., subset=...): clamp numeric columns (if subset=None, clamps all numeric schema fields).
  • cast_many / cast_subset: multi-column cast helpers.
  • fill_null_many / fill_null_subset: multi-column fill-null helpers.
  • rename_upper/lower/title/strip(...): schema-driven rename helpers.
  • pivot_longer(...) / pivot_wider(...): reshape convenience wrappers around melt / pivot.

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

planframe_pandas-1.3.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

planframe_pandas-1.3.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file planframe_pandas-1.3.0.tar.gz.

File metadata

  • Download URL: planframe_pandas-1.3.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for planframe_pandas-1.3.0.tar.gz
Algorithm Hash digest
SHA256 52699750afc78e808232213e3f3bc1e84d5f6cd190cc19dfd0361bb6c62f30f9
MD5 a1317a08ffef27a253abc2b2ab844de8
BLAKE2b-256 20aeaadf92fab951a00e52d75aadf334af111737c99930115b9e7d832b57fe4a

See more details on using hashes here.

File details

Details for the file planframe_pandas-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for planframe_pandas-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf9aa9157b0bd5a4fc60d09e83fe8cfe5ac9d4c40f55614b6a5229d79d45103
MD5 b3304c5e717c2494761b6dbd6ed4f4cc
BLAKE2b-256 5f9e89a5a354fb5f662c71eb87a15f96fd8e13374778239c769c77250235fd8b

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