# xarray.core.accessor_str.StringAccessor.capitalize

#### StringAccessor.capitalize()[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_str.py#L682-L707)

Convert strings in the array to be capitalized.

* **Returns:**
  **capitalized** (`same type as values`)

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('93734ffb-d00f-4348-a43f-24a3663e3f53','82d263c8-2b52-4e4f-91fb-9cdf42a2f15a','0fe2c98d-cf77-4770-ace4-667a5e17dc43','../lite/tree/../notebooks/index.html?path=d2bf23a0_3a18_4c1b_82d9_fdd80586cf66.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(
...     ["temperature", "PRESSURE", "PreCipiTation", "daily rainfall"], dims="x"
... )
>>> da
<xarray.DataArray (x: 4)> Size: 224B
array(['temperature', 'PRESSURE', 'PreCipiTation', 'daily rainfall'],
      dtype='<U14')
Dimensions without coordinates: x
>>> capitalized = da.str.capitalize()
>>> capitalized
<xarray.DataArray (x: 4)> Size: 224B
array(['Temperature', 'Pressure', 'Precipitation', 'Daily rainfall'],
      dtype='<U14')
Dimensions without coordinates: x
```

<div id="0fe2c98d-cf77-4770-ace4-667a5e17dc43" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('93734ffb-d00f-4348-a43f-24a3663e3f53','0fe2c98d-cf77-4770-ace4-667a5e17dc43')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('93734ffb-d00f-4348-a43f-24a3663e3f53','0fe2c98d-cf77-4770-ace4-667a5e17dc43')">Open In Tab</button></div><div id="82d263c8-2b52-4e4f-91fb-9cdf42a2f15a" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
