pandas.api.extensions.register_extension_dtype

pandas.api.extensions.register_extension_dtype(cls)[source]

Register an ExtensionType with pandas as class decorator.

This enables operations like .astype(name) for the name of the ExtensionDtype.

Returns:
callable

A class decorator.

Examples

>>> from pandas.api.extensions import register_extension_dtype, ExtensionDtype
>>> @register_extension_dtype
... class MyExtensionDtype(ExtensionDtype):
...     name = "myextension"