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 73
73
validate_indices ,
74
74
)
75
75
from pandas .core .nanops import check_below_min_count
76
- from pandas .core .strings .base import BaseStringArrayMethods
77
76
78
77
from pandas .io ._util import _arrow_dtype_mapping
79
78
from pandas .tseries .frequencies import to_offset
@@ -237,7 +236,6 @@ class ArrowExtensionArray(
237
236
OpsMixin ,
238
237
ExtensionArraySupportsAnyAll ,
239
238
ArrowStringArrayMixin ,
240
- BaseStringArrayMethods ,
241
239
):
242
240
"""
243
241
Pandas ExtensionArray backed by a PyArrow ChunkedArray.
Original file line number Diff line number Diff line change 2
2
Implementation of pandas.Series.str and its interface.
3
3
4
4
* strings.accessor.StringMethods : Accessor for Series.str
5
- * strings.base.BaseStringArrayMethods: Mixin ABC for EAs to implement str methods
6
5
7
6
Most methods on the StringMethods accessor follow the pattern:
8
7
9
8
1. extract the array from the series (or index)
10
9
2. Call that array's implementation of the string method
11
10
3. Wrap the result (in a Series, index, or DataFrame)
12
11
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,
16
13
these are prefixed with `_str_`. So ``Series.str.upper()`` calls
17
14
``Series.array._str_upper()``. The interface isn't currently public
18
15
to other string extension arrays.
19
16
"""
20
17
# Pandas current implementation is in ObjectStringArrayMixin. This is designed
21
18
# to work on object-dtype ndarrays.
22
19
#
23
- # BaseStringArrayMethods
24
20
# - ObjectStringArrayMixin
25
21
# - StringArray
26
22
# - NumpyExtensionArray
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 21
21
from pandas .core .dtypes .common import pandas_dtype
22
22
from pandas .core .dtypes .missing import isna
23
23
24
- from pandas .core .strings .base import BaseStringArrayMethods
25
-
26
24
if TYPE_CHECKING :
27
25
from collections .abc import (
28
26
Callable ,
35
33
)
36
34
37
35
38
- class ObjectStringArrayMixin ( BaseStringArrayMethods ) :
36
+ class ObjectStringArrayMixin :
39
37
"""
40
38
String Methods operating on object-dtype ndarrays.
41
39
"""
@@ -44,6 +42,12 @@ def __len__(self) -> int:
44
42
# For typing, _str_map relies on the object being sized.
45
43
raise NotImplementedError
46
44
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
+
47
51
def _str_map (
48
52
self ,
49
53
f ,
You can’t perform that action at this time.
0 commit comments