pandera.engines.engine.Engine.register_dtype

Engine.register_dtype(pandera_dtype_cls=None, *, equivalents=None)[source]

Register a Pandera DataType with the engine, as class decorator.

Parameters
  • pandera_dtype – The DataType to register.

  • equivalents (Optional[List[Any]]) – Equivalent scalar data type classes or non-parametrized data type instances.

Note

The classmethod from_parametrized_dtype will also be registered. See here for more usage details.

Example

>>> import pandera as pa
>>>
>>> class MyDataType(pa.DataType):
...     pass
>>>
>>> class MyEngine(
...     metaclass=pa.engines.engine.Engine,
...     base_pandera_dtypes=MyDataType,
... ):
...     pass
>>>
>>> @MyEngine.register_dtype(equivalents=[bool])
... class MyBool(MyDataType):
...     pass
Return type

Callable