# xarray.core.accessor_str.StringAccessor.swapcase

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

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('7351d856-252f-4ab7-a914-84a591ef4343','fd7b0593-7226-46cf-82bc-8cd56ff18415','b1ff9f41-d910-42d1-b7b9-611ead474731','../lite/tree/../notebooks/index.html?path=0303dacf_ab5f_4bab_8b58_30befed6d396.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="b1ff9f41-d910-42d1-b7b9-611ead474731" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('7351d856-252f-4ab7-a914-84a591ef4343','b1ff9f41-d910-42d1-b7b9-611ead474731')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('7351d856-252f-4ab7-a914-84a591ef4343','b1ff9f41-d910-42d1-b7b9-611ead474731')">Open In Tab</button></div><div id="fd7b0593-7226-46cf-82bc-8cd56ff18415" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
