From d3c595e83f442a61cedeb6656bf9f6ee7dc1d2df Mon Sep 17 00:00:00 2001 From: Espoir Murhabazi Date: Mon, 11 Nov 2024 10:51:29 +0000 Subject: [PATCH] ENH: Set __module__ on StringDtype (#60261) --- pandas/core/arrays/string_.py | 6 +++++- pandas/tests/api/test_api.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/core/arrays/string_.py b/pandas/core/arrays/string_.py index de129df2575d3..9b1f986a7158e 100644 --- a/pandas/core/arrays/string_.py +++ b/pandas/core/arrays/string_.py @@ -28,7 +28,10 @@ pa_version_under10p1, ) from pandas.compat.numpy import function as nv -from pandas.util._decorators import doc +from pandas.util._decorators import ( + doc, + set_module, +) from pandas.util._exceptions import find_stack_level from pandas.core.dtypes.base import ( @@ -86,6 +89,7 @@ from pandas import Series +@set_module("pandas") @register_extension_dtype class StringDtype(StorageExtensionDtype): """ diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 25285a451bb3f..00b0236c236c0 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -405,6 +405,7 @@ def test_set_module(): assert pd.IntervalDtype.__module__ == "pandas" assert pd.SparseDtype.__module__ == "pandas" assert pd.ArrowDtype.__module__ == "pandas" + assert pd.StringDtype.__module__ == "pandas" assert pd.Index.__module__ == "pandas" assert pd.CategoricalIndex.__module__ == "pandas" assert pd.DatetimeIndex.__module__ == "pandas"