🍾 Xarray is now 10 years old! 🎉

xarray.Dataset.__setitem__

xarray.Dataset.__setitem__#

Dataset.__setitem__(key, value)[source]#

Add an array to this dataset. Multiple arrays can be added at the same time, in which case each of the following operations is applied to the respective value.

If key is dict-like, update all variables in the dataset one by one with the given value at the given location. If the given value is also a dataset, select corresponding variables in the given value and in the dataset to be changed.

If value is a ` from .dataarray import DataArray`, call its select_vars() method, rename it to key and merge the contents of the resulting dataset into this dataset.

If value is a Variable object (or tuple of form (dims, data[, attrs])), add it to this dataset as a new variable.