Skip to content

Commit 070e8f3

Browse files
author
tp
committed
Small addition/cleanup + resolved merge conflict
1 parent 6008e3c commit 070e8f3

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pandas/core/indexes/multi.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -2009,14 +2009,14 @@ def get_loc(self, key, method=None):
20092009
Notes
20102010
------
20112011
The key cannot be a slice, list of same-level labels, a boolean mask,
2012-
or a sequence of such. If you want to use those, use :meth:`get_locs`
2013-
instead.
2012+
or a sequence of such. If you want to use those, use
2013+
:meth:`MultiIndex.get_locs` instead.
20142014
20152015
See also
20162016
--------
20172017
Index.get_loc : get_loc method for (single-level) index.
2018-
get_locs : Get location for a label/slice/list/mask or a sequence of
2019-
such.
2018+
MultiIndex.get_locs : Get location for a label/slice/list/mask or a
2019+
sequence of such.
20202020
"""
20212021
if method is not None:
20222022
raise NotImplementedError('only the default get_loc method is '
@@ -2340,23 +2340,24 @@ def convert_indexer(start, stop, step, indexer=indexer, labels=labels):
23402340
def get_locs(self, seq):
23412341
"""
23422342
Get location for a given label/slice/list/mask or a sequence of such as
2343-
a integer, slice or boolean mask.
2343+
an array of integers.
23442344
23452345
Parameters
23462346
----------
2347-
seq : label/slice/list/mask or a sequence of such.
2347+
seq : label/slice/list/mask or a sequence of such
2348+
You should use one of the above for each level.
2349+
If a level should not be used, set it to ``slice(None)``.
23482350
23492351
Returns
23502352
-------
2351-
locs : integer, slice or boolean mask suitable
2352-
for passing to iloc
2353+
locs : array of integers suitable for passing to iloc
23532354
23542355
Examples
23552356
---------
23562357
>>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')])
23572358
23582359
>>> mi.get_locs('b')
2359-
slice(1, 3, None)
2360+
array([1, 2], dtype=int64)
23602361
23612362
>>> mi.get_locs([slice(None), ['e', 'f']])
23622363
array([1, 2], dtype=int64)
@@ -2366,7 +2367,7 @@ def get_locs(self, seq):
23662367
23672368
See also
23682369
--------
2369-
get_loc : Get location for a label or a tuple of labels.
2370+
MultiIndex.get_loc : Get location for a label or a tuple of labels.
23702371
"""
23712372

23722373
# must be lexsorted to at least as many levels

0 commit comments

Comments
 (0)