Index.slice_indexer(self, start=None, end=None, step=None, kind=None)
[source]
For an ordered or unique index, compute the slice indexer for input labels and step.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
This function assumes that the data is sorted, so use at your own peril
This is a method on all index types. For example you can do:
>>> idx = pd.Index(list('abcd')) >>> idx.slice_indexer(start='b', end='c') slice(1, 3)
>>> idx = pd.MultiIndex.from_arrays([list('abcd'), list('efgh')]) >>> idx.slice_indexer(start='b', end=('c', 'g')) slice(1, 3)
© 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.Index.slice_indexer.html