Skip to content

Commit 8c47625

Browse files
Mikhaylov-yvJulianWgs
authored andcommitted
DOC: add searchsorted examples pandas-dev#36411 (pandas-dev#37370)
* DOC: add searchsorted examples * Update base.py * corrected values * Update base.py
1 parent 339955d commit 8c47625

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/core/base.py

+10
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,16 @@ def factorize(self, sort: bool = False, na_sentinel: Optional[int] = -1):
12011201
>>> ser.searchsorted([1, 3], side='right')
12021202
array([1, 3])
12031203
1204+
>>> ser = pd.Series(pd.to_datetime(['3/11/2000', '3/12/2000', '3/13/2000']))
1205+
>>> ser
1206+
0 2000-03-11
1207+
1 2000-03-12
1208+
2 2000-03-13
1209+
dtype: datetime64[ns]
1210+
1211+
>>> ser.searchsorted('3/14/2000')
1212+
3
1213+
12041214
>>> ser = pd.Categorical(
12051215
... ['apple', 'bread', 'bread', 'cheese', 'milk'], ordered=True
12061216
... )

0 commit comments

Comments
 (0)