pandas / 1.4.0 / reference / api / pandas.api.extensions.register_extension_dtype.html /

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"

© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.4.0/reference/api/pandas.api.extensions.register_extension_dtype.html