Skip to content

ENH: Set __module__ on StringDtype #60261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -86,6 +89,7 @@
from pandas import Series


@set_module("pandas")
@register_extension_dtype
class StringDtype(StorageExtensionDtype):
"""
Expand Down Expand Up @@ -374,6 +378,7 @@ def __from_arrow__(
return new_string_array


@set_module("pandas")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError: module 'pandas' has no attribute 'BaseStringArray'

class BaseStringArray(ExtensionArray):
"""
Mixin class for StringArray, ArrowStringArray.
Expand Down Expand Up @@ -532,6 +537,8 @@ def _str_map_nan_semantics(

# error: Definition of "_concat_same_type" in base class "NDArrayBacked" is
# incompatible with definition in base class "ExtensionArray"


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these additions

class StringArray(BaseStringArray, NumpyExtensionArray): # type: ignore[misc]
"""
Extension array for string data.
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,4 @@ def test_set_module():
assert pd.Period.__module__ == "pandas"
assert pd.Timestamp.__module__ == "pandas"
assert pd.Timedelta.__module__ == "pandas"
assert pd.StringDtype.__module__ == "pandas"