# 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('b2f4ff95-512b-4983-bc4f-c6f99d76b796','36d23b6e-bd1c-4e15-a0f5-cd63bea14fd8','40257113-5027-4aef-b411-56c06e1f044c','../lite/tree/../notebooks/index.html?path=a32b0ee8_6fcf_4b9b_b436_6de8016b4938.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="40257113-5027-4aef-b411-56c06e1f044c" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('b2f4ff95-512b-4983-bc4f-c6f99d76b796','40257113-5027-4aef-b411-56c06e1f044c')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('b2f4ff95-512b-4983-bc4f-c6f99d76b796','40257113-5027-4aef-b411-56c06e1f044c')">Open In Tab</button></div><div id="36d23b6e-bd1c-4e15-a0f5-cd63bea14fd8" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
