# xarray.core.accessor_str.StringAccessor.swapcase

#### StringAccessor.swapcase()[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/accessor_str.py#L748-L769)

Convert strings in the array to be swapcased.

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

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('a393170f-f8dd-4ab7-8cba-1b2e3ada0c57','c93e20bf-8df6-4fab-b4dc-989ed14dfd11','c75dfd39-aaf3-4739-be32-b2a2b5fcd35b','../lite/tree/../notebooks/index.html?path=fafa4703_deda_40ed_856f_2adc712babac.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import xarray as xr
>>> da = xr.DataArray(["temperature", "PRESSURE", "HuMiDiTy"], dims="x")
>>> da
<xarray.DataArray (x: 3)> Size: 132B
array(['temperature', 'PRESSURE', 'HuMiDiTy'], dtype='<U11')
Dimensions without coordinates: x
>>> swapcased = da.str.swapcase()
>>> swapcased
<xarray.DataArray (x: 3)> Size: 132B
array(['TEMPERATURE', 'pressure', 'hUmIdItY'], dtype='<U11')
Dimensions without coordinates: x
```

<div id="c75dfd39-aaf3-4739-be32-b2a2b5fcd35b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('a393170f-f8dd-4ab7-8cba-1b2e3ada0c57','c75dfd39-aaf3-4739-be32-b2a2b5fcd35b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('a393170f-f8dd-4ab7-8cba-1b2e3ada0c57','c75dfd39-aaf3-4739-be32-b2a2b5fcd35b')">Open In Tab</button></div><div id="c93e20bf-8df6-4fab-b4dc-989ed14dfd11" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
