10
10
11
11
import numpy as np
12
12
from pandas .core .base import PandasObject
13
+ from pandas .util ._decorators import deprecate_kwarg
13
14
from pandas .core .dtypes .cast import coerce_indexer_dtype
14
15
from pandas .io .formats .printing import pprint_thing
15
16
@@ -117,10 +118,10 @@ def __unicode__(self):
117
118
quote_strings = True )
118
119
return "%s(%s, dtype='%s')" % (type (self ).__name__ , prepr , self .dtype )
119
120
120
- def searchsorted (self , v , side = 'left' , sorter = None ):
121
+ @deprecate_kwarg (old_arg_name = "v" , new_arg_name = "value" )
122
+ def searchsorted (self , value , side = "left" , sorter = None ):
121
123
"""
122
- Find indices where elements of v should be inserted
123
- in a to maintain order.
124
+ Find indices to insert `value` so as to maintain order.
124
125
125
126
For full documentation, see `numpy.searchsorted`
126
127
@@ -129,17 +130,20 @@ def searchsorted(self, v, side='left', sorter=None):
129
130
numpy.searchsorted : equivalent function
130
131
"""
131
132
132
- # we are much more performant if the searched
133
- # indexer is the same type as the array
134
- # this doesn't matter for int64, but DOES
135
- # matter for smaller int dtypes
136
- # https://github.com/numpy/numpy/issues/5370
133
+ # We are much more performant if the searched
134
+ # indexer is the same type as the array.
135
+ #
136
+ # This doesn't matter for int64, but DOES
137
+ # matter for smaller int dtypes.
138
+ #
139
+ # xref: https://github.com/numpy/numpy/issues/5370
137
140
try :
138
- v = self .dtype .type (v )
141
+ value = self .dtype .type (value )
139
142
except :
140
143
pass
144
+
141
145
return super (FrozenNDArray , self ).searchsorted (
142
- v , side = side , sorter = sorter )
146
+ value , side = side , sorter = sorter )
143
147
144
148
145
149
def _ensure_frozen (array_like , categories , copy = False ):
0 commit comments