Skip to content

Commit

Permalink
DOC: Add MultiIndex.get_locs to generated reference (#30234)
Browse files Browse the repository at this point in the history
* DOC: Add MultiIndex.get_locs to generated reference

* fixups
  • Loading branch information
jorisvandenbossche authored and TomAugspurger committed Dec 12, 2019
1 parent 4fe7c99 commit e28ebe3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/source/reference/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ MultiIndex selecting
:toctree: api/

MultiIndex.get_loc
MultiIndex.get_locs
MultiIndex.get_loc_level
MultiIndex.get_indexer
MultiIndex.get_level_values
Expand Down
26 changes: 13 additions & 13 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2879,37 +2879,37 @@ def convert_indexer(start, stop, step, indexer=indexer, codes=level_codes):

def get_locs(self, seq):
"""
Get location for a given label/slice/list/mask or a sequence of such as
an array of integers.
Get location for a sequence of labels.
Parameters
----------
seq : label/slice/list/mask or a sequence of such
seq : label, slice, list, mask or a sequence of such
You should use one of the above for each level.
If a level should not be used, set it to ``slice(None)``.
Returns
-------
locs : array of integers suitable for passing to iloc
numpy.ndarray
NumPy array of integers suitable for passing to iloc.
See Also
--------
MultiIndex.get_loc : Get location for a label or a tuple of labels.
MultiIndex.slice_locs : Get slice location given start label(s) and
end label(s).
Examples
--------
>>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')])
>>> mi.get_locs('b')
>>> mi.get_locs('b') # doctest: +SKIP
array([1, 2], dtype=int64)
>>> mi.get_locs([slice(None), ['e', 'f']])
>>> mi.get_locs([slice(None), ['e', 'f']]) # doctest: +SKIP
array([1, 2], dtype=int64)
>>> mi.get_locs([[True, False, True], slice('e', 'f')])
>>> mi.get_locs([[True, False, True], slice('e', 'f')]) # doctest: +SKIP
array([2], dtype=int64)
See Also
--------
MultiIndex.get_loc : Get location for a label or a tuple of labels.
MultiIndex.slice_locs : Get slice location given start label(s) and
end label(s).
"""
from .numeric import Int64Index

Expand Down

0 comments on commit e28ebe3

Please sign in to comment.