W3cubDocs

/pandas 2

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–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.api.extensions.register_extension_dtype.html