Skip to content

Commit e34338a

Browse files
authored
API: make construct_array_type non-optional (#41862)
1 parent 9936902 commit e34338a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

doc/source/whatsnew/v1.3.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ Other API changes
697697
- 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`)
698698
- 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`)
699699
- Removed redundant ``freq`` from :class:`PeriodIndex` string representation (:issue:`41653`)
700+
- :meth:`ExtensionDtype.construct_array_type` is now a required method instead of an optional one for :class:`ExtensionDtype` subclasses (:issue:`24860`)
700701

701702
Build
702703
=====

pandas/core/dtypes/base.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ExtensionDtype:
4848
4949
* type
5050
* name
51+
* construct_array_type
5152
5253
The following attributes and methods influence the behavior of the dtype in
5354
pandas operations
@@ -56,12 +57,6 @@ class ExtensionDtype:
5657
* _is_boolean
5758
* _get_common_dtype
5859
59-
Optionally one can override construct_array_type for construction
60-
with the name of this dtype via the Registry. See
61-
:meth:`extensions.register_extension_dtype`.
62-
63-
* construct_array_type
64-
6560
The `na_value` class attribute can be used to set the default NA value
6661
for this type. :attr:`numpy.nan` is used by default.
6762
@@ -205,7 +200,7 @@ def construct_array_type(cls) -> type_t[ExtensionArray]:
205200
-------
206201
type
207202
"""
208-
raise NotImplementedError
203+
raise AbstractMethodError(cls)
209204

210205
@classmethod
211206
def construct_from_string(cls, string: str):

0 commit comments

Comments
 (0)