# xarray.DataArray.str.swapcase

#### DataArray.str.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('852fe72d-01cf-4eef-91c7-dec184c3000d','11c9da9d-c51f-4525-ae14-5f1be009bb07','073a6c47-656d-45ea-9975-6403bad969c9','../lite/tree/../notebooks/index.html?path=755461dd_9cde_4783_803e_88aa94047711.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="073a6c47-656d-45ea-9975-6403bad969c9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('852fe72d-01cf-4eef-91c7-dec184c3000d','073a6c47-656d-45ea-9975-6403bad969c9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('852fe72d-01cf-4eef-91c7-dec184c3000d','073a6c47-656d-45ea-9975-6403bad969c9')">Open In Tab</button></div><div id="11c9da9d-c51f-4525-ae14-5f1be009bb07" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
