File tree Expand file tree Collapse file tree 4 files changed +8
-284
lines changed Expand file tree Collapse file tree 4 files changed +8
-284
lines changed Original file line number Diff line number Diff line change 7373 validate_indices ,
7474)
7575from pandas .core .nanops import check_below_min_count
76- from pandas .core .strings .base import BaseStringArrayMethods
7776
7877from pandas .io ._util import _arrow_dtype_mapping
7978from pandas .tseries .frequencies import to_offset
@@ -237,7 +236,6 @@ class ArrowExtensionArray(
237236 OpsMixin ,
238237 ExtensionArraySupportsAnyAll ,
239238 ArrowStringArrayMixin ,
240- BaseStringArrayMethods ,
241239):
242240 """
243241 Pandas ExtensionArray backed by a PyArrow ChunkedArray.
Original file line number Diff line number Diff line change 22Implementation 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
76Most 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,
1613these are prefixed with `_str_`. So ``Series.str.upper()`` calls
1714``Series.array._str_upper()``. The interface isn't currently public
1815to 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
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2121from pandas .core .dtypes .common import pandas_dtype
2222from pandas .core .dtypes .missing import isna
2323
24- from pandas .core .strings .base import BaseStringArrayMethods
25-
2624if TYPE_CHECKING :
2725 from collections .abc import (
2826 Callable ,
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 ,
You can’t perform that action at this time.
0 commit comments