pandera.engines.polars_engine.Category

class pandera.engines.polars_engine.Category(categories=None)[source]

Pandera categorical data type for polars.

Attributes

auto_coerce

Whether to force coerce to be True in all cases

categories

continuous

Whether the number data type is continuous.

ordered

Methods

__init__(categories=None)[source]
check(pandera_dtype, data_container=None)[source]

Check that pandera DataType are equivalent.

Parameters:
  • pandera_dtype (DataType) – Expected DataType.

  • data_container (Union[LazyFrame, PolarsData, None]) – Data container, used by data types that require the actual data for validation.

Return type:

Union[bool, Iterable[bool]]

Returns:

boolean scalar or iterable of boolean scalars, indicating which elements passed the check.

coerce(data_container)[source]

Coerce data container to the data type.

Return type:

LazyFrame

coerce_value(value)[source]

Coerce an value to a particular type.

try_coerce(data_container)[source]

Coerce data container to the data type,

raises a ParserError if the coercion fails :raises: ParserError: if coercion fails

Return type:

LazyFrame

__call__(data_container)[source]

Coerce data container to the data type.