# 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.14/site-packages/pandas/core/indexes/base.py#L6912-L6998)

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('f83605c8-b955-4965-a137-53ef9a0bc7c9','c03f4ae0-b5c2-4dec-80b7-75bc4487d5bc','a79e271c-50cb-4513-ae30-ab5c20f5fdee','../lite/tree/../notebooks/index.html?path=4b5b59c1_96cd_4040_9eb1_6b794c811ee4.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="a79e271c-50cb-4513-ae30-ab5c20f5fdee" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('f83605c8-b955-4965-a137-53ef9a0bc7c9','a79e271c-50cb-4513-ae30-ab5c20f5fdee')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('f83605c8-b955-4965-a137-53ef9a0bc7c9','a79e271c-50cb-4513-ae30-ab5c20f5fdee')">Open In Tab</button></div><div id="c03f4ae0-b5c2-4dec-80b7-75bc4487d5bc" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
