Skip to content

Commit

Permalink
DOC: correct Series.searchsorted example (pandas-dev#19784)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuBaohe authored and harisbal committed Feb 28, 2018
1 parent a60e325 commit e8e925b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,21 +1165,16 @@ def factorize(self, sort=False, na_sentinel=-1):
>>> x.searchsorted([1, 3], side='right')
array([1, 3])
>>> x = pd.Categorical(['apple', 'bread', 'bread', 'cheese', 'milk' ])
>>> x = pd.Categorical(['apple', 'bread', 'bread',
'cheese', 'milk'], ordered=True)
[apple, bread, bread, cheese, milk]
Categories (4, object): [apple < bread < cheese < milk]
>>> x.searchsorted('bread')
array([1]) # Note: an array, not a scalar
>>> x.searchsorted(['bread'])
array([1])
>>> x.searchsorted(['bread', 'eggs'])
array([1, 4])
>>> x.searchsorted(['bread', 'eggs'], side='right')
array([3, 4]) # eggs before milk
>>> x.searchsorted(['bread'], side='right')
array([3])
""")

@Substitution(klass='IndexOpsMixin')
Expand Down

0 comments on commit e8e925b

Please sign in to comment.