A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.xarray.dev/en/stable/generated/xarray.Dataset.set_coords.html below:

xarray.Dataset.set_coords

xarray.Dataset.set_coords#
Dataset.set_coords(names)[source]#

Given names of one or more variables, set them as coordinates

Parameters:

names (hashable or iterable of hashable) – Name(s) of variables in this dataset to convert into coordinates.

Examples

>>> dataset = xr.Dataset(
...     {
...         "pressure": ("time", [1.013, 1.2, 3.5]),
...         "time": pd.date_range("2023-01-01", periods=3),
...     }
... )
>>> dataset
<xarray.Dataset> Size: 48B
Dimensions:   (time: 3)
Coordinates:
  * time      (time) datetime64[ns] 24B 2023-01-01 2023-01-02 2023-01-03
Data variables:
    pressure  (time) float64 24B 1.013 1.2 3.5
>>> dataset.set_coords("pressure")
<xarray.Dataset> Size: 48B
Dimensions:   (time: 3)
Coordinates:
    pressure  (time) float64 24B 1.013 1.2 3.5
  * time      (time) datetime64[ns] 24B 2023-01-01 2023-01-02 2023-01-03
Data variables:
    *empty*

On calling set_coords , these data variables are converted to coordinates, as shown in the final dataset.

Returns:

Dataset


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4