# 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('e0527b9f-c0e4-4eb6-b691-692b61866e40','913e65df-47e8-45d3-81c5-8b811c3dd02e','1aa85f8a-5093-4a34-ac80-009c50845d40','../lite/tree/../notebooks/index.html?path=2fa17798_a672_4b06_be78_b3d0d1feb7c8.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="1aa85f8a-5093-4a34-ac80-009c50845d40" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('e0527b9f-c0e4-4eb6-b691-692b61866e40','1aa85f8a-5093-4a34-ac80-009c50845d40')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('e0527b9f-c0e4-4eb6-b691-692b61866e40','1aa85f8a-5093-4a34-ac80-009c50845d40')">Open In Tab</button></div><div id="913e65df-47e8-45d3-81c5-8b811c3dd02e" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
