# xarray.Dataset.reset_coords

#### Dataset.reset_coords(names=None, drop=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L1959-L2054)

Given names of coordinates, reset them to become variables

* **Parameters:**
  * **names** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#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.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('adafa521-a273-41eb-aec5-bd66149b8ab9','d72ce4a3-9fc6-425f-a329-29d1bdecb1f7','85b1e4f1-b6e3-4ef5-961a-f408471ca439','../lite/tree/../notebooks/index.html?path=02b78503_bc11_4176_a036_42ad12e4dd35.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> dataset = xr.Dataset(
...     {
...         "temperature": (
...             ["time", "lat", "lon"],
...             [[[25, 26], [27, 28]], [[29, 30], [31, 32]]],
...         ),
...         "precipitation": (
...             ["time", "lat", "lon"],
...             [[[0.5, 0.8], [0.2, 0.4]], [[0.3, 0.6], [0.7, 0.9]]],
...         ),
...     },
...     coords={
...         "time": pd.date_range(start="2023-01-01", periods=2),
...         "lat": [40, 41],
...         "lon": [-80, -79],
...         "altitude": 1000,
...     },
... )
```

# Dataset before resetting coordinates

```pycon
>>> dataset
<xarray.Dataset> Size: 184B
Dimensions:        (time: 2, lat: 2, lon: 2)
Coordinates:
  * time           (time) datetime64[us] 16B 2023-01-01 2023-01-02
  * lat            (lat) int64 16B 40 41
  * lon            (lon) int64 16B -80 -79
    altitude       int64 8B 1000
Data variables:
    temperature    (time, lat, lon) int64 64B 25 26 27 28 29 30 31 32
    precipitation  (time, lat, lon) float64 64B 0.5 0.8 0.2 0.4 0.3 0.6 0.7 0.9
```

# Reset the ‘altitude’ coordinate

```pycon
>>> dataset_reset = dataset.reset_coords("altitude")
```

# Dataset after resetting coordinates

```pycon
>>> dataset_reset
<xarray.Dataset> Size: 184B
Dimensions:        (time: 2, lat: 2, lon: 2)
Coordinates:
  * time           (time) datetime64[us] 16B 2023-01-01 2023-01-02
  * lat            (lat) int64 16B 40 41
  * lon            (lon) int64 16B -80 -79
Data variables:
    temperature    (time, lat, lon) int64 64B 25 26 27 28 29 30 31 32
    precipitation  (time, lat, lon) float64 64B 0.5 0.8 0.2 0.4 0.3 0.6 0.7 0.9
    altitude       int64 8B 1000
```

<div id="85b1e4f1-b6e3-4ef5-961a-f408471ca439" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('adafa521-a273-41eb-aec5-bd66149b8ab9','85b1e4f1-b6e3-4ef5-961a-f408471ca439')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('adafa521-a273-41eb-aec5-bd66149b8ab9','85b1e4f1-b6e3-4ef5-961a-f408471ca439')">Open In Tab</button></div><div id="d72ce4a3-9fc6-425f-a329-29d1bdecb1f7" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
* **Returns:**
  [`Dataset`](xarray.Dataset.html.md#xarray.Dataset)

#### SEE ALSO
[`Dataset.set_coords`](xarray.Dataset.set_coords.html.md#xarray.Dataset.set_coords)
