pandera-polars

Write and validate Pandera schemas for Polars DataFrame and LazyFrame pipelines.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill pandera-polars-schattenspiegel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pandera-polars
Source: https://github.com/schattenspiegel/skill-foundry-skills/tree/main/skills/pandera-polars
Command: npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill pandera-polars-schattenspiegel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandera, polars, and includes scripts (resource) and references (resource) components.

What problem does it solve? Data pipelines built on Polars often lack explicit runtime contracts, so dtype drift, unexpected nulls, extra columns, and silent coercion bugs reach production undetected. This Skill guides the creation of executable Pandera schemas for the Polars backend so validation rules, coercion policy, and failure handling are explicit and testable. ## Core Features & Use Cases - Schema authoring guidance: Choose between DataFrameSchema for programmatic composition and DataFrameModel for declarative named contracts, with explicit strict, coerce, nullable, and unique policies. - Validation depth control: Distinguish schema-only LazyFrame validation from full data-level checks on eager DataFrames, and aggregate failures with lazy=True. - Native custom checks: Write vectorized Polars checks via PolarsData returning Boolean LazyFrames instead of slow element-wise Python callbacks. - Use Case: You ingest CSV order data into a Polars pipeline. Define a strict DataFrameSchema requiring order_id as unique non-null Int64, country in an allowed set, and amount non-negative, then validate at ingress with lazy=True to collect all failures at once. ## Quick Start Ask the AI to write a strict Pandera Polars DataFrameSchema that validates your orders DataFrame with unique integer IDs, an allowed country set, and aggregated failure reporting.

Frequently Asked Questions about pandera-polars

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a Polars DataFrame with Pandera?▼

Import pandera.polars as pa, define a DataFrameSchema with Column objects specifying dtypes, nullability, and checks, then call schema.validate(frame). Use lazy=True to aggregate multiple failures into a SchemaErrors exception with structured failure cases.

What is the difference between DataFrameSchema and DataFrameModel in Pandera?▼

DataFrameSchema is a runtime value composed from Column and Check objects, suited for dynamic or programmatic schemas. DataFrameModel is a class declaration using annotations and Field, suited for stable named contracts. Pick one as the single source of truth.

Does Pandera validate data inside a Polars LazyFrame?▼

By default, Pandera's native Polars integration performs schema-level validation on a LazyFrame without executing all data-level checks on the uncollected plan. To verify row values, validate an eager DataFrame or establish a documented full-data execution boundary.

How do I write a custom vectorized check for Pandera Polars?▼

Write a function accepting PolarsData and returning a Boolean LazyFrame built from native Polars expressions, then pass it to pa.Check. Avoid element_wise=True, which routes through a slower Python row path in the Polars backend.

Can I reuse pandas Pandera schemas with the Polars backend?▼

No. Backend behavior differs across pandas, Polars, and other backends, and features like index handling, groupby checks, parsers, and synthesis are pandas-specific. Import pandera.polars explicitly and verify supported features against the installed version.