Skip to content

Commit cc03c5d

Browse files
committed
REF: remove unnecessary string mixin
1 parent 810a504 commit cc03c5d

File tree

3 files changed

+8
-282
lines changed

3 files changed

+8
-282
lines changed

pandas/core/strings/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@
22
Implementation of pandas.Series.str and its interface.
33
44
* strings.accessor.StringMethods : Accessor for Series.str
5-
* strings.base.BaseStringArrayMethods: Mixin ABC for EAs to implement str methods
65
76
Most methods on the StringMethods accessor follow the pattern:
87
98
1. extract the array from the series (or index)
109
2. Call that array's implementation of the string method
1110
3. Wrap the result (in a Series, index, or DataFrame)
1211
13-
Pandas extension arrays implementing string methods should inherit from
14-
pandas.core.strings.base.BaseStringArrayMethods. This is an ABC defining
15-
the various string methods. To avoid namespace clashes and pollution,
12+
To avoid namespace clashes and pollution,
1613
these are prefixed with `_str_`. So ``Series.str.upper()`` calls
1714
``Series.array._str_upper()``. The interface isn't currently public
1815
to other string extension arrays.
1916
"""
2017
# Pandas current implementation is in ObjectStringArrayMixin. This is designed
2118
# to work on object-dtype ndarrays.
2219
#
23-
# BaseStringArrayMethods
2420
# - ObjectStringArrayMixin
2521
# - StringArray
2622
# - NumpyExtensionArray

pandas/core/strings/base.py

Lines changed: 0 additions & 274 deletions
This file was deleted.

pandas/core/strings/object_array.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
from pandas.core.dtypes.common import pandas_dtype
2222
from pandas.core.dtypes.missing import isna
2323

24-
from pandas.core.strings.base import BaseStringArrayMethods
25-
2624
if TYPE_CHECKING:
2725
from collections.abc import (
2826
Callable,
@@ -35,7 +33,7 @@
3533
)
3634

3735

38-
class ObjectStringArrayMixin(BaseStringArrayMethods):
36+
class ObjectStringArrayMixin:
3937
"""
4038
String Methods operating on object-dtype ndarrays.
4139
"""
@@ -44,6 +42,12 @@ def __len__(self) -> int:
4442
# For typing, _str_map relies on the object being sized.
4543
raise NotImplementedError
4644

45+
def _str_getitem(self, key):
46+
if isinstance(key, slice):
47+
return self._str_slice(start=key.start, stop=key.stop, step=key.step)
48+
else:
49+
return self._str_get(key)
50+
4751
def _str_map(
4852
self,
4953
f,

0 commit comments

Comments
 (0)