# xarray.Dataset._\_setitem_\_

#### Dataset.\_\_setitem_\_(key, value)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L1464-L1537)

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.
