pandas.Index.slice_locs — pandas 1.0.1 documentation (original) (raw)

Index. slice_locs(self, start=None, end=None, step=None, kind=None)[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{‘ix’, ‘loc’, ‘getitem’} or None

Returns

start, endint

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)