MCPcopy Create free account
hub / github.com/pydata/xarray / var

Method var

xarray/core/_aggregations.py:7784–7904  ·  view source on GitHub ↗

Reduce this DataArray's data by applying ``var`` along some dimension(s). Parameters ---------- dim : str, Iterable of Hashable, "..." or None, default: None Name of dimension[s] along which to apply ``var``. For e.g. ``dim="x"`` or ``dim=["x

(
        self,
        dim: Dims = None,
        *,
        skipna: bool | None = None,
        ddof: int = 0,
        keep_attrs: bool | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

7782 return out
7783
7784 def var(
7785 self,
7786 dim: Dims = None,
7787 *,
7788 skipna: bool | None = None,
7789 ddof: int = 0,
7790 keep_attrs: bool | None = None,
7791 **kwargs: Any,
7792 ) -> DataArray:
7793 """
7794 Reduce this DataArray's data by applying ``var`` along some dimension(s).
7795
7796 Parameters
7797 ----------
7798 dim : str, Iterable of Hashable, "..." or None, default: None
7799 Name of dimension[s] along which to apply ``var``. For e.g. ``dim="x"``
7800 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
7801 If "...", will reduce over all dimensions.
7802 skipna : bool or None, optional
7803 If True, skip missing values (as marked by NaN). By default, only
7804 skips missing values for float dtypes; other dtypes either do not
7805 have a sentinel missing value (int) or ``skipna=True`` has not been
7806 implemented (object, datetime64 or timedelta64).
7807 ddof : int, default: 0
7808 “Delta Degrees of Freedom”: the divisor used in the calculation is ``N - ddof``,
7809 where ``N`` represents the number of elements.
7810 keep_attrs : bool or None, optional
7811 If True, ``attrs`` will be copied from the original
7812 object to the new one. If False, the new object will be
7813 returned without attributes.
7814 **kwargs : Any
7815 Additional keyword arguments passed on to the appropriate array
7816 function for calculating ``var`` on this object's data.
7817 These could include dask-specific kwargs like ``split_every``.
7818
7819 Returns
7820 -------
7821 reduced : DataArray
7822 New DataArray with ``var`` applied to its data and the
7823 indicated dimension(s) removed
7824
7825 See Also
7826 --------
7827 numpy.var
7828 dask.array.var
7829 DataArray.var
7830 :ref:`groupby`
7831 User guide on groupby operations.
7832
7833 Notes
7834 -----
7835 Use the ``flox`` package to significantly speed up groupby computations,
7836 especially with dask arrays. Xarray will use flox by default if installed.
7837 Pass flox-specific keyword arguments in ``**kwargs``.
7838 See the `flox documentation <https://flox.readthedocs.io>`_ for more.
7839
7840 Non-numeric variables will be removed prior to reducing.
7841

Callers

nothing calls this directly

Calls 3

_flox_reduceMethod · 0.95
reduceMethod · 0.95

Tested by

no test coverage detected