pandera.engines.engine.Engine

class pandera.engines.engine.Engine(name, bases, namespace, **kwargs)[source]

Base Engine metaclass.

Keep a registry of concrete Engines.

Methods

dtype(data_type)[source]

Convert input into a Pandera DataType object.

Return type:

DataType

get_registered_dtypes()[source]

Return the pandera.dtypes.DataTypes registered with this engine.

Return type:

List[Type[DataType]]

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], None]) – 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

__call__(*args, **kwargs)

Call self as a function.