# xarray.DataArray.str.swapcase

#### DataArray.str.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('c99926f0-f18b-4761-b204-e5b1644ca272','8b24ecdc-cb23-45c2-b592-70ea90158d50','affdbb45-f51a-4e22-a67a-19b4408502fb','../lite/tree/../notebooks/index.html?path=c9edd838_f89d_426c_b681_21102c84a91b.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="affdbb45-f51a-4e22-a67a-19b4408502fb" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('c99926f0-f18b-4761-b204-e5b1644ca272','affdbb45-f51a-4e22-a67a-19b4408502fb')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('c99926f0-f18b-4761-b204-e5b1644ca272','affdbb45-f51a-4e22-a67a-19b4408502fb')">Open In Tab</button></div><div id="8b24ecdc-cb23-45c2-b592-70ea90158d50" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
