# xarray.CFTimeIndex.get_slice_bound

#### CFTimeIndex.get_slice_bound(label, side)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L7247-L7333)

Calculate slice bound that corresponds to given label.

Returns leftmost (one-past-the-rightmost if `side=='right'`) position
of given label.

* **Parameters:**
  * **label** ([`object`](https://docs.python.org/3/builtins/functions.html#object)) – The label for which to calculate the slice bound.
  * **side** (`{'left', 'right'}`) – if ‘left’ return leftmost position of given label.
    if ‘right’ return one-past-the-rightmost position of given label.
* **Returns:**
  [`int`](https://docs.python.org/3/builtins/functions.html#int) – Index of label.

#### SEE ALSO
`Index.get_loc`
: Get integer location, slice or boolean mask for requested label.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('3e94f0d3-0cb3-4d37-819b-53c4551f6b3e','33e4d42a-5cdb-4460-8665-8c19761efaa6','875f554b-1dea-467c-9a31-977987e2ed3b','../lite/tree/../notebooks/index.html?path=f7979eb3_7cbd_4121_9d69_26b531282885.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.RangeIndex(5)
>>> idx.get_slice_bound(3, "left")
3
```

```pycon
>>> idx.get_slice_bound(3, "right")
4
```

If `label` is non-unique in the index, an error will be raised.

```pycon
>>> idx_duplicate = pd.Index(["a", "b", "a", "c", "d"])
>>> idx_duplicate.get_slice_bound("a", "left")
Traceback (most recent call last):
KeyError: Cannot get left slice bound for non-unique label: 'a'
```

<div id="875f554b-1dea-467c-9a31-977987e2ed3b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('3e94f0d3-0cb3-4d37-819b-53c4551f6b3e','875f554b-1dea-467c-9a31-977987e2ed3b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('3e94f0d3-0cb3-4d37-819b-53c4551f6b3e','875f554b-1dea-467c-9a31-977987e2ed3b')">Open In Tab</button></div><div id="33e4d42a-5cdb-4460-8665-8c19761efaa6" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
