pandera.engines.narwhals_engine.DateTime

class pandera.engines.narwhals_engine.DateTime(time_unit=None, time_zone=None)[source]

Narwhals datetime data type.

Attributes

auto_coerce

Whether to force coerce to be True in all cases

continuous

Whether the number data type is continuous.

Methods

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

Check that pandera DataType are equivalent.

Parameters:
  • pandera_dtype (DataType) – Expected DataType.

  • data_container (UnionType[Any, 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.

Accepts a NarwhalsData or a nw.LazyFrame. Always returns a nw.LazyFrame (lazy — does not collect).

Return type:

LazyFrame

coerce_value(value)[source]

Coerce an value to a particular type.

classmethod from_parametrized_dtype(nw_dtype)[source]

Convert a parameterized nw.Datetime instance to a Pandera DateTime.

Return type:

Self

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.