# xarray.core.accessor_str.StringAccessor.endswith

#### StringAccessor.endswith(pat)[[source]](https://github.com/pydata/xarray/blob/v2026.09.0/xarray/core/accessor_str.py#L1193-L1227)

Test if the end of each string in the array matches a pattern.

The pattern pat can either be a `str` or array-like of `str`.
If array-like, it will be broadcast and applied elementwise.

* **Parameters:**
  **pat** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Character sequence. Regular expressions are not accepted.
  If array-like, it is broadcast.
* **Returns:**
  **endswith** ([array](https://numpy.org/doc/stable/glossary.html#term-array) of [`bool`](https://docs.python.org/3/builtins/functions.html#bool)) – A Series of booleans indicating whether the given pattern matches
  the end of each string element.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('5a4648ba-e21a-410c-9283-544e514975c2','78ae425f-d74d-47f7-8f0d-d45d2b7b205f','b41fc628-8475-45ab-bd06-a1b6fd01ca94','../lite/tree/../notebooks/index.html?path=7b914559_d730_4e37_b2a6_aa29e5ea2bf9.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(["10C", "10c", "100F"], dims="x")
>>> da
<xarray.DataArray (x: 3)> Size: 48B
array(['10C', '10c', '100F'], dtype='<U4')
Dimensions without coordinates: x
>>> endswith = da.str.endswith("C")
>>> endswith
<xarray.DataArray (x: 3)> Size: 3B
array([ True, False, False])
Dimensions without coordinates: x
```

<div id="b41fc628-8475-45ab-bd06-a1b6fd01ca94" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('5a4648ba-e21a-410c-9283-544e514975c2','b41fc628-8475-45ab-bd06-a1b6fd01ca94')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('5a4648ba-e21a-410c-9283-544e514975c2','b41fc628-8475-45ab-bd06-a1b6fd01ca94')">Open In Tab</button></div><div id="78ae425f-d74d-47f7-8f0d-d45d2b7b205f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
