# xarray.CFTimeIndex.slice_locs

#### CFTimeIndex.slice_locs(start=None, end=None, step=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.14/site-packages/pandas/core/indexes/base.py#L7000-L7099)

Compute slice locations for input labels.

* **Parameters:**
  * **start** (`label`, *default* [`None`](https://docs.python.org/3/builtins/constants.html#None)) – If None, defaults to the beginning.
  * **end** (`label`, *default* [`None`](https://docs.python.org/3/builtins/constants.html#None)) – If None, defaults to the end.
  * **step** ([`int`](https://docs.python.org/3/builtins/functions.html#int), `defaults None`) – If None, defaults to 1.
* **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_loc`
: Get location for a single label.

### Notes

This method only works if the index is monotonic or unique.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('1464f686-578e-46ac-8566-ebe95dc65ce2','42ef3b86-d2f0-4910-9b23-c41986d90f9f','aa239508-44b6-4837-8d09-62f510867abd','../lite/tree/../notebooks/index.html?path=c1403a8a_6e29_47d4_91b2_69aaa747e97b.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(list("abcd"))
>>> idx.slice_locs(start="b", end="c")
(1, 3)
```

```pycon
>>> idx = pd.Index(list("bcde"))
>>> idx.slice_locs(start="a", end="c")
(0, 2)
```

<div id="aa239508-44b6-4837-8d09-62f510867abd" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('1464f686-578e-46ac-8566-ebe95dc65ce2','aa239508-44b6-4837-8d09-62f510867abd')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('1464f686-578e-46ac-8566-ebe95dc65ce2','aa239508-44b6-4837-8d09-62f510867abd')">Open In Tab</button></div><div id="42ef3b86-d2f0-4910-9b23-c41986d90f9f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
