Skip to content

Commit f8dfcfb

Browse files
ZhuBaohejorisvandenbossche
authored andcommitted
DOC: correct Series.searchsorted example (pandas-dev#19784)
1 parent e5be6bd commit f8dfcfb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pandas/core/base.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1165,21 +1165,16 @@ def factorize(self, sort=False, na_sentinel=-1):
11651165
>>> x.searchsorted([1, 3], side='right')
11661166
array([1, 3])
11671167
1168-
>>> x = pd.Categorical(['apple', 'bread', 'bread', 'cheese', 'milk' ])
1168+
>>> x = pd.Categorical(['apple', 'bread', 'bread',
1169+
'cheese', 'milk'], ordered=True)
11691170
[apple, bread, bread, cheese, milk]
11701171
Categories (4, object): [apple < bread < cheese < milk]
11711172
11721173
>>> x.searchsorted('bread')
11731174
array([1]) # Note: an array, not a scalar
11741175
1175-
>>> x.searchsorted(['bread'])
1176-
array([1])
1177-
1178-
>>> x.searchsorted(['bread', 'eggs'])
1179-
array([1, 4])
1180-
1181-
>>> x.searchsorted(['bread', 'eggs'], side='right')
1182-
array([3, 4]) # eggs before milk
1176+
>>> x.searchsorted(['bread'], side='right')
1177+
array([3])
11831178
""")
11841179

11851180
@Substitution(klass='IndexOpsMixin')

0 commit comments

Comments
 (0)