xarray.CFTimeIndex.slice_locs#
- CFTimeIndex.slice_locs(start=None, end=None, step=None)[source]#
Compute slice locations for input labels.
- Parameters:
- Returns:
tuple[int,int]– Returns a tuple of two integers representing the slice locations for the input labels within the index.
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)
>>> idx = pd.Index(list("bcde")) >>> idx.slice_locs(start="a", end="c") (0, 2)