pandera.engines.narwhals_engine.Engine¶
- class pandera.engines.narwhals_engine.Engine[source]¶
Narwhals data type engine.
Methods
- classmethod dtype(data_type)[source]¶
Convert input into a Narwhals-compatible Pandera
DataTypeobject.If
data_typeis an engine-specific dtype from another backend (e.g.polars_engine.Int64), the method falls back to the shared abstract pandera base class (e.g.dtypes.Int64) so cross-engine dtype comparisons work without importing the foreign engine.Parametrized narwhals native instances (e.g.
nw.Datetime("us")) are dispatched through theirfrom_parametrized_dtypehandler so their parameters (time_unit, time_zone) are preserved; the baseget_equivalentfast-path would otherwise collapse them onto the un-parametrized dtype (anw.Datetimeinstance compares equal to thenw.Datetimeclass, so the equivalents lookup shadows the parametrized form).- Return type: