Skip to content

Commit 805c7c2

Browse files
committed
Squashed commit of the following:
commit 9b646e2 Author: Tom Augspurger <[email protected]> Date: Tue Sep 11 14:07:15 2018 -0500 Doc fixup commit b1aac08 Author: Tom Augspurger <[email protected]> Date: Tue Sep 11 13:57:18 2018 -0500 API: register_extension_dtype class decorator Closes pandas-dev#22664
1 parent 98ac047 commit 805c7c2

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

pandas/core/dtypes/base.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class ExtensionDtype(_DtypeOpsMixin):
127127
* _is_numeric
128128
129129
Optionally one can override construct_array_type for construction
130-
with the name of this dtype via the Registry
130+
with the name of this dtype via the Registry. See
131+
:meth:`pandas.api.extensions.register_extension_dtype`.
131132
132133
* construct_array_type
133134
@@ -138,6 +139,11 @@ class ExtensionDtype(_DtypeOpsMixin):
138139
Methods and properties required by the interface raise
139140
``pandas.errors.AbstractMethodError`` and no ``register`` method is
140141
provided for registering virtual subclasses.
142+
143+
See Also
144+
--------
145+
pandas.api.extensions.register_extension_dtype
146+
pandas.api.extensions.ExtensionArray
141147
"""
142148

143149
def __str__(self):

pandas/core/dtypes/dtypes.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
def register_extension_dtype(cls):
1212
"""Class decorator to register an ExtensionType with pandas.
1313
14+
.. versionadded:: 0.24.0
15+
1416
This enables operations like ``.astype(name)`` for the name
1517
of the ExtensionDtype.
1618

pandas/tests/extension/json/test_json.py

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def assert_frame_equal(self, left, right, *args, **kwargs):
118118
class TestDtype(BaseJSON, base.BaseDtypeTests):
119119
pass
120120

121+
121122
class TestInterface(BaseJSON, base.BaseInterfaceTests):
122123
def test_custom_asserts(self):
123124
# This would always trigger the KeyError from trying to put

pandas/tests/extension/test_integer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from pandas.tests.extension import base
2121
from pandas.core.dtypes.common import is_extension_array_dtype
2222

23-
from pandas.core.arrays import IntegerArray, integer_array
23+
from pandas.core.arrays import integer_array
2424
from pandas.core.arrays.integer import (
2525
Int8Dtype, Int16Dtype, Int32Dtype, Int64Dtype,
2626
UInt8Dtype, UInt16Dtype, UInt32Dtype, UInt64Dtype)

0 commit comments

Comments
 (0)