Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
validate_indices,
)
from pandas.core.nanops import check_below_min_count
from pandas.core.strings.base import BaseStringArrayMethods

from pandas.io._util import _arrow_dtype_mapping
from pandas.tseries.frequencies import to_offset
Expand Down Expand Up @@ -237,7 +236,6 @@ class ArrowExtensionArray(
OpsMixin,
ExtensionArraySupportsAnyAll,
ArrowStringArrayMixin,
BaseStringArrayMethods,
):
"""
Pandas ExtensionArray backed by a PyArrow ChunkedArray.
Expand Down
6 changes: 1 addition & 5 deletions pandas/core/strings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@
Implementation of pandas.Series.str and its interface.

* strings.accessor.StringMethods : Accessor for Series.str
* strings.base.BaseStringArrayMethods: Mixin ABC for EAs to implement str methods

Most methods on the StringMethods accessor follow the pattern:

1. extract the array from the series (or index)
2. Call that array's implementation of the string method
3. Wrap the result (in a Series, index, or DataFrame)

Pandas extension arrays implementing string methods should inherit from
pandas.core.strings.base.BaseStringArrayMethods. This is an ABC defining
the various string methods. To avoid namespace clashes and pollution,
To avoid namespace clashes and pollution,
these are prefixed with `_str_`. So ``Series.str.upper()`` calls
``Series.array._str_upper()``. The interface isn't currently public
to other string extension arrays.
"""
# Pandas current implementation is in ObjectStringArrayMixin. This is designed
# to work on object-dtype ndarrays.
#
# BaseStringArrayMethods
# - ObjectStringArrayMixin
# - StringArray
# - NumpyExtensionArray
Expand Down
274 changes: 0 additions & 274 deletions pandas/core/strings/base.py

This file was deleted.

10 changes: 7 additions & 3 deletions pandas/core/strings/object_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
from pandas.core.dtypes.common import pandas_dtype
from pandas.core.dtypes.missing import isna

from pandas.core.strings.base import BaseStringArrayMethods

if TYPE_CHECKING:
from collections.abc import (
Callable,
Expand All @@ -35,7 +33,7 @@
)


class ObjectStringArrayMixin(BaseStringArrayMethods):
class ObjectStringArrayMixin:
"""
String Methods operating on object-dtype ndarrays.
"""
Expand All @@ -44,6 +42,12 @@ def __len__(self) -> int:
# For typing, _str_map relies on the object being sized.
raise NotImplementedError

def _str_getitem(self, key):
if isinstance(key, slice):
return self._str_slice(start=key.start, stop=key.stop, step=key.step)
else:
return self._str_get(key)

def _str_map(
self,
f,
Expand Down
Loading