Skip to main content

Polars backend adapter for PlanFrame.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

planframe-polars

Polars adapter package for PlanFrame. Import as planframe_polars.

Usage

import polars as pl
from dataclasses import dataclass

from planframe_polars import PolarsFrame


@dataclass(frozen=True)
class UserSchema:
    id: int
    age: int


lf = pl.DataFrame({"id": [1], "age": [2]}).lazy()
class User(PolarsFrame):
    id: int
    age: int

pf = User(lf)
df = pf.select("id").collect()

# Or construct from python data:
pf2 = User({"id": [1], "age": [2]})

Execution model

PlanFrame is always lazy:

  • Chaining methods (like .select(...)) does not run Polars operations.
  • collect() evaluates the full plan. If the source is a polars.LazyFrame, this naturally compiles into a single lazy query before collecting.

Notes (Polars-specific)

  • Pivot: LazyFrame.pivot(...) requires on_columns to be provided up-front (Polars must know the output schema prior to collect()). PlanFrame enforces this at execution time.
  • concat_vertical: implemented via polars.concat(..., how="vertical").
  • Join: implemented via LazyFrame.join(...) / DataFrame.join(...) using the provided on, how, and suffix.

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_polars-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

planframe_polars-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file planframe_polars-0.1.0.tar.gz.

File metadata

  • Download URL: planframe_polars-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for planframe_polars-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4606ce3a49a6f005e016c02702ad738f48850de7b19626e46cd05ffcbb35bb46
MD5 0d15cbd200b6831a2509cd33280de7ee
BLAKE2b-256 74ba629851baee75737ae8bd6abf9e073157b3c75d696ea7bb6bc011775a370f

See more details on using hashes here.

File details

Details for the file planframe_polars-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for planframe_polars-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fae2945d8bd03acb2b9e2a284b9cc316c519ff1575b180f92a86361f9e71157b
MD5 d7866a09c16c337b20d17a7ccaa97691
BLAKE2b-256 26da9889f2dbc46825d0c6ebd7ed1933d35245ce78637e0c363496f958015d56

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