Skip to main content

Schema.check()

Validate frame against this snapshot.

Usage

Source

Schema.check(
    frame,
    *,
    context,
)

context is "fit" or "transform". At "fit" every schema column is required; at "transform" only columns flagged in transform_required are. In both contexts, columns that are present must match the snapshot dtype. Extra columns beyond the snapshot are ignored. Dtypes are compared exactly (see the class docstring).

Parameters

frame: Frame

The data frame to validate.

context: str
"fit" or "transform". Any value other than "fit" is treated as "transform". Recipe.fit() checks the frame it just took the snapshot from, so at "fit" the check cannot fail in practice; it exists so both phases go through one code path.

Raises

ValueError
If a required column is missing, or a present column’s dtype differs from the snapshot.