Compute slice locations for input labels.
If None, defaults to the beginning.
If None, defaults to the end.
If None, defaults to 1.
See also
Index.get_locGet location for a single label.
Notes
This method only works if the index is monotonic or unique.
Examples
>>> idx = pd.Index(list('abcd'))
>>> idx.slice_locs(start='b', end='c')
(1, 3)
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Index.slice_locs.html