diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index 287ec69f65cd6..a01de0d831cc6 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -697,6 +697,7 @@ Other API changes - Accessing ``_constructor_expanddim`` on a :class:`DataFrame` and ``_constructor_sliced`` on a :class:`Series` now raise an ``AttributeError``. Previously a ``NotImplementedError`` was raised (:issue:`38782`) - Added new ``engine`` and ``**engine_kwargs`` parameters to :meth:`DataFrame.to_sql` to support other future "SQL engines". Currently we still only use ``SQLAlchemy`` under the hood, but more engines are planned to be supported such as ``turbodbc`` (:issue:`36893`) - Removed redundant ``freq`` from :class:`PeriodIndex` string representation (:issue:`41653`) +- :meth:`ExtensionDtype.construct_array_type` is now a required method instead of an optional one for :class:`ExtensionDtype` subclasses (:issue:`24860`) Build ===== diff --git a/pandas/core/dtypes/base.py b/pandas/core/dtypes/base.py index 414c60603b9fe..903146b083946 100644 --- a/pandas/core/dtypes/base.py +++ b/pandas/core/dtypes/base.py @@ -48,6 +48,7 @@ class ExtensionDtype: * type * name + * construct_array_type The following attributes and methods influence the behavior of the dtype in pandas operations @@ -56,12 +57,6 @@ class ExtensionDtype: * _is_boolean * _get_common_dtype - Optionally one can override construct_array_type for construction - with the name of this dtype via the Registry. See - :meth:`extensions.register_extension_dtype`. - - * construct_array_type - The `na_value` class attribute can be used to set the default NA value for this type. :attr:`numpy.nan` is used by default. @@ -210,7 +205,7 @@ def construct_array_type(cls) -> type_t[ExtensionArray]: ------- type """ - raise NotImplementedError + raise AbstractMethodError(cls) @classmethod def construct_from_string(cls, string: str):