# 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('51d6251a-754c-493f-91f5-97495fc57a8c','462c8ed5-d6e8-4aab-be32-abb48e92a264','fc97fee0-626d-4d3c-bcf5-ecf75aab7ef9','../lite/tree/../notebooks/index.html?path=bbb8bb7a_ba0a_4415_a5e5_f22baf98e630.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="fc97fee0-626d-4d3c-bcf5-ecf75aab7ef9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('51d6251a-754c-493f-91f5-97495fc57a8c','fc97fee0-626d-4d3c-bcf5-ecf75aab7ef9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('51d6251a-754c-493f-91f5-97495fc57a8c','fc97fee0-626d-4d3c-bcf5-ecf75aab7ef9')">Open In Tab</button></div><div id="462c8ed5-d6e8-4aab-be32-abb48e92a264" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
