diff --git a/pandas/core/arrays/boolean.py b/pandas/core/arrays/boolean.py index 298e5ddb049ec..aca2cafe80889 100644 --- a/pandas/core/arrays/boolean.py +++ b/pandas/core/arrays/boolean.py @@ -14,6 +14,7 @@ lib, missing as libmissing, ) +from pandas.util._decorators import set_module from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.dtypes import register_extension_dtype @@ -39,6 +40,7 @@ @register_extension_dtype +@set_module("pandas") class BooleanDtype(BaseMaskedDtype): """ Extension dtype for boolean data. diff --git a/pandas/core/arrays/floating.py b/pandas/core/arrays/floating.py index 8a04fca42c082..ed6ed6b22ad48 100644 --- a/pandas/core/arrays/floating.py +++ b/pandas/core/arrays/floating.py @@ -8,6 +8,8 @@ import numpy as np +from pandas.util._decorators import set_module + from pandas.core.dtypes.base import register_extension_dtype from pandas.core.dtypes.common import is_float_dtype @@ -168,6 +170,7 @@ class FloatingArray(NumericArray): @register_extension_dtype +@set_module("pandas") class Float32Dtype(FloatingDtype): type = np.float32 name: ClassVar[str] = "Float32" @@ -175,6 +178,7 @@ class Float32Dtype(FloatingDtype): @register_extension_dtype +@set_module("pandas") class Float64Dtype(FloatingDtype): type = np.float64 name: ClassVar[str] = "Float64" diff --git a/pandas/core/arrays/integer.py b/pandas/core/arrays/integer.py index 9ed776317bd8e..366b508f9d400 100644 --- a/pandas/core/arrays/integer.py +++ b/pandas/core/arrays/integer.py @@ -8,6 +8,8 @@ import numpy as np +from pandas.util._decorators import set_module + from pandas.core.dtypes.base import register_extension_dtype from pandas.core.dtypes.common import is_integer_dtype @@ -218,6 +220,7 @@ class IntegerArray(NumericArray): @register_extension_dtype +@set_module("pandas") class Int8Dtype(IntegerDtype): type = np.int8 name: ClassVar[str] = "Int8" @@ -225,6 +228,7 @@ class Int8Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class Int16Dtype(IntegerDtype): type = np.int16 name: ClassVar[str] = "Int16" @@ -232,6 +236,7 @@ class Int16Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class Int32Dtype(IntegerDtype): type = np.int32 name: ClassVar[str] = "Int32" @@ -239,6 +244,7 @@ class Int32Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class Int64Dtype(IntegerDtype): type = np.int64 name: ClassVar[str] = "Int64" @@ -246,6 +252,7 @@ class Int64Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class UInt8Dtype(IntegerDtype): type = np.uint8 name: ClassVar[str] = "UInt8" @@ -253,6 +260,7 @@ class UInt8Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class UInt16Dtype(IntegerDtype): type = np.uint16 name: ClassVar[str] = "UInt16" @@ -260,6 +268,7 @@ class UInt16Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class UInt32Dtype(IntegerDtype): type = np.uint32 name: ClassVar[str] = "UInt32" @@ -267,6 +276,7 @@ class UInt32Dtype(IntegerDtype): @register_extension_dtype +@set_module("pandas") class UInt64Dtype(IntegerDtype): type = np.uint64 name: ClassVar[str] = "UInt64" diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 2c26f77102df1..49c5daee9fc43 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -412,11 +412,23 @@ def test_util_in_top_level(self): def test_set_module(): assert pd.DataFrame.__module__ == "pandas" assert pd.CategoricalDtype.__module__ == "pandas" + assert pd.DatetimeTZDtype.__module__ == "pandas" assert pd.PeriodDtype.__module__ == "pandas" assert pd.IntervalDtype.__module__ == "pandas" assert pd.SparseDtype.__module__ == "pandas" assert pd.ArrowDtype.__module__ == "pandas" assert pd.StringDtype.__module__ == "pandas" + assert pd.BooleanDtype.__module__ == "pandas" + assert pd.Int8Dtype.__module__ == "pandas" + assert pd.Int16Dtype.__module__ == "pandas" + assert pd.Int32Dtype.__module__ == "pandas" + assert pd.Int64Dtype.__module__ == "pandas" + assert pd.UInt8Dtype.__module__ == "pandas" + assert pd.UInt16Dtype.__module__ == "pandas" + assert pd.UInt32Dtype.__module__ == "pandas" + assert pd.UInt64Dtype.__module__ == "pandas" + assert pd.Float32Dtype.__module__ == "pandas" + assert pd.Float64Dtype.__module__ == "pandas" assert pd.Index.__module__ == "pandas" assert pd.CategoricalIndex.__module__ == "pandas" assert pd.DatetimeIndex.__module__ == "pandas"