pandera.backends.narwhals.checks.NarwhalsCheckBackendΒΆ

class pandera.backends.narwhals.checks.NarwhalsCheckBackend(check)[source]ΒΆ

Check backend for Narwhals.

Initializes a check backend object.

Methods

__init__(check)[source]ΒΆ

Initializes a check backend object.

aggregate(check_obj)[source]ΒΆ

Implements aggregation behavior for check object.

apply(check_obj)[source]ΒΆ

Apply check function β€” dispatch on self.check.native flag.

groupby(check_obj)[source]ΒΆ

Implements groupby behavior for check object.

postprocess(check_obj, check_output)[source]ΒΆ

Postprocesses the result of applying the check function.

postprocess_bool_output(check_obj, check_output)[source]ΒΆ

Postprocesses bool check output into a CheckResult.

Return type:

CheckResult

postprocess_expr_output(check_obj, expr)[source]ΒΆ

Postprocesses nw.Expr check output into a CheckResult.

Stores the original expr as check_output and defers failure_cases computation entirely β€” no wide table is built during the check loop.

When drop_invalid_rows=True: failure_cases are never needed, so this avoids all per-check materialization. When SchemaErrors is raised: failure_cases_metadata() in base.py reconstructs them from the stored expr exactly once.

check_passed is computed via a single-column select+aggregate (frame.select(expr) β†’ apply ignore_na on column β†’ .select(.all())) rather than frame.with_columns(expr) which keeps all original columns.

ignore_na is applied at the column level AFTER evaluation rather than as expr | expr.is_null() β€” the latter causes ibis to produce incorrect SQL (isnull() on an expression before binding returns True for all rows on some SQL backends, because the expression is treated as nullable).

Return type:

CheckResult

postprocess_lazyframe_output(check_obj, check_output)[source]ΒΆ

Postprocesses LazyFrame check output into a CheckResult.

Return type:

CheckResult

preprocess(check_obj, key)[source]ΒΆ

Preprocesses a check object before applying the check function.

query(check_obj)[source]ΒΆ

Implements querying behavior to produce subset of check object.

__call__(check_obj, key=None)[source]ΒΆ

Call self as a function.

Return type:

CheckResult