MultiIndex.get_loc(self, key, method=None) [source]
Get location for a label or a tuple of labels as an integer, slice or boolean mask.
| Parameters: |
|
|---|---|
| Returns: |
|
See also
Index.get_loc
MultiIndex.slice_locs MultiIndex.get_locs The key cannot be a slice, list of same-level labels, a boolean mask, or a sequence of such. If you want to use those, use MultiIndex.get_locs() instead.
>>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')])
>>> mi.get_loc('b')
slice(1, 3, None)
>>> mi.get_loc(('b', 'e'))
1
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.MultiIndex.get_loc.html