pandas.api.extensions.register_extension_dtype#

pandas.api.extensions.register_extension_dtype(cls)[源代码]#

将 ExtensionType 作为类装饰器注册到 pandas。

这使得可以对 ExtensionDtype 的名称执行诸如 .astype(name) 之类的操作。

Returns:
callable

类装饰器。

Examples

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