parq_blockmodel.schema.utils.validate_chunk

Contents

parq_blockmodel.schema.utils.validate_chunk#

parq_blockmodel.schema.utils.validate_chunk(dataframe, schema)[source]#

Validate and coerce a single DataFrame chunk against a schema.

The schema is applied with lazy=True so all column errors are collected before raising, and inplace=False so the original chunk is not mutated. Coercion (type casting) is performed when the schema has coerce=True set on its columns.

Parameters:
  • dataframe (pd.DataFrame) – A pandas DataFrame chunk to validate.

  • schema (DataFrameSchema) – The pandera schema to validate against.

Returns:

The validated (and possibly coerced) DataFrame.

Return type:

pd.DataFrame

Raises:

pandera.errors.SchemaErrors – If the chunk fails validation (when pandera raises in lazy mode).