# xarray.DataArray.reset_coords

#### DataArray.reset_coords(names=None, , drop=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L1141-L1226)

Given names of coordinates, reset them to become variables.

* **Parameters:**
  * **names** ([`str`](xarray.DataArray.str.html.md#xarray.DataArray.str), `Iterable` of `Hashable` or [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – Name(s) of non-index coordinates in this dataset to reset into
    variables. By default, all non-index coordinates are reset.
  * **drop** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – If True, remove coordinates instead of converting them into
    variables.
* **Returns:**
  [`Dataset`](xarray.Dataset.html.md#xarray.Dataset), or `DataArray if ``drop == True```

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('3a23a7d4-b3a8-4f78-9c44-dd2ec5d73a59','6f27eb70-cf1f-4426-a245-3ff0df7e6e0c','7d5055ea-80f8-492f-9709-792f81da85eb','../lite/tree/../notebooks/index.html?path=00c16243_2b39_49fa_b71e_e1954a0f79a8.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> temperature = np.arange(25).reshape(5, 5)
>>> pressure = np.arange(50, 75).reshape(5, 5)
>>> da = xr.DataArray(
...     data=temperature,
...     dims=["x", "y"],
...     coords=dict(
...         lon=("x", np.arange(10, 15)),
...         lat=("y", np.arange(20, 25)),
...         Pressure=(["x", "y"], pressure),
...     ),
...     name="Temperature",
... )
>>> da
<xarray.DataArray 'Temperature' (x: 5, y: 5)> Size: 200B
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])
Coordinates:
    lon       (x) int64 40B 10 11 12 13 14
    lat       (y) int64 40B 20 21 22 23 24
    Pressure  (x, y) int64 200B 50 51 52 53 54 55 56 57 ... 68 69 70 71 72 73 74
Dimensions without coordinates: x, y
```

Return Dataset with target coordinate as a data variable rather than a coordinate variable:

```pycon
>>> da.reset_coords(names="Pressure")
<xarray.Dataset> Size: 480B
Dimensions:      (x: 5, y: 5)
Coordinates:
    lon          (x) int64 40B 10 11 12 13 14
    lat          (y) int64 40B 20 21 22 23 24
Dimensions without coordinates: x, y
Data variables:
    Pressure     (x, y) int64 200B 50 51 52 53 54 55 56 ... 68 69 70 71 72 73 74
    Temperature  (x, y) int64 200B 0 1 2 3 4 5 6 7 8 ... 17 18 19 20 21 22 23 24
```

Return DataArray without targeted coordinate:

```pycon
>>> da.reset_coords(names="Pressure", drop=True)
<xarray.DataArray 'Temperature' (x: 5, y: 5)> Size: 200B
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])
Coordinates:
    lon      (x) int64 40B 10 11 12 13 14
    lat      (y) int64 40B 20 21 22 23 24
Dimensions without coordinates: x, y
```

<div id="7d5055ea-80f8-492f-9709-792f81da85eb" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('3a23a7d4-b3a8-4f78-9c44-dd2ec5d73a59','7d5055ea-80f8-492f-9709-792f81da85eb')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('3a23a7d4-b3a8-4f78-9c44-dd2ec5d73a59','7d5055ea-80f8-492f-9709-792f81da85eb')">Open In Tab</button></div><div id="6f27eb70-cf1f-4426-a245-3ff0df7e6e0c" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
