pandas.Index.slice_locs#
- Index.slice_locs(start=None, end=None, step=None, kind=NoDefault.no_default)[source]#
Compute slice locations for input labels.
- Parameters
- startlabel, default None
If None, defaults to the beginning.
- endlabel, default None
If None, defaults to the end.
- stepint, defaults None
If None, defaults to 1.
- kind{‘loc’, ‘getitem’} or None
Deprecated since version 1.4.0.
- Returns
- start, endint
See also
Index.get_loc
Get 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)