# xarray.DataArray.str.endswith

#### DataArray.str.endswith(pat)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_str.py#L1224-L1259)

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('519c2592-f605-4c5a-aea3-4dee83246372','4079640f-5cb1-41a4-b740-a256941e7e5a','315fbca6-afc6-44b1-8aa3-82e5f6f8f740','../lite/tree/../notebooks/index.html?path=c7c0ca73_e287_4c6a_bcd4_446654c4c435.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="315fbca6-afc6-44b1-8aa3-82e5f6f8f740" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('519c2592-f605-4c5a-aea3-4dee83246372','315fbca6-afc6-44b1-8aa3-82e5f6f8f740')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('519c2592-f605-4c5a-aea3-4dee83246372','315fbca6-afc6-44b1-8aa3-82e5f6f8f740')">Open In Tab</button></div><div id="4079640f-5cb1-41a4-b740-a256941e7e5a" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
