# xarray.Dataset.weighted

#### Dataset.weighted(weights)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L10533-L10566)

Weighted Dataset operations.

* **Parameters:**
  **weights** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray)) – An array of weights associated with the values in this Dataset.
  Each value in the data contributes to the reduction operation
  according to its associated weight.

### Notes

`weights` must be a DataArray and cannot contain missing values.
Missing values can be replaced by `weights.fillna(0)`.

* **Returns:**
  [`computation.weighted.DatasetWeighted`](xarray.computation.weighted.DatasetWeighted.html.md#xarray.computation.weighted.DatasetWeighted)

#### SEE ALSO
[`DataArray.weighted`](xarray.DataArray.weighted.html.md#xarray.DataArray.weighted)

[Weighted array reductions](../user-guide/computation.html.md#compute-weighted)
: User guide on weighted array reduction using [`weighted()`](#xarray.Dataset.weighted)

[Weighted Reductions](https://tutorial.xarray.dev/fundamentals/03.4_weighted.html)
: Tutorial on Weighted Reduction using [`weighted()`](#xarray.Dataset.weighted)
