MCPcopy Index your code
hub / github.com/pydata/xarray / var

Method var

xarray/namedarray/_aggregations.py:626–704  ·  view source on GitHub ↗

Reduce this NamedArray'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=["

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

Source from the content-addressed store, hash-verified

624 )
625
626 def var(
627 self,
628 dim: Dims = None,
629 *,
630 skipna: bool | None = None,
631 ddof: int = 0,
632 **kwargs: Any,
633 ) -> Self:
634 """
635 Reduce this NamedArray's data by applying ``var`` along some dimension(s).
636
637 Parameters
638 ----------
639 dim : str, Iterable of Hashable, "..." or None, default: None
640 Name of dimension[s] along which to apply ``var``. For e.g. ``dim="x"``
641 or ``dim=["x", "y"]``. If "..." or None, will reduce over all dimensions.
642 skipna : bool or None, optional
643 If True, skip missing values (as marked by NaN). By default, only
644 skips missing values for float dtypes; other dtypes either do not
645 have a sentinel missing value (int) or ``skipna=True`` has not been
646 implemented (object, datetime64 or timedelta64).
647 ddof : int, default: 0
648 “Delta Degrees of Freedom”: the divisor used in the calculation is ``N - ddof``,
649 where ``N`` represents the number of elements.
650 **kwargs : Any
651 Additional keyword arguments passed on to the appropriate array
652 function for calculating ``var`` on this object's data.
653 These could include dask-specific kwargs like ``split_every``.
654
655 Returns
656 -------
657 reduced : NamedArray
658 New NamedArray with ``var`` applied to its data and the
659 indicated dimension(s) removed
660
661 See Also
662 --------
663 numpy.var
664 dask.array.var
665 Dataset.var
666 DataArray.var
667 :ref:`agg`
668 User guide on reduction or aggregation operations.
669
670 Notes
671 -----
672 Non-numeric variables will be removed prior to reducing.
673
674 Examples
675 --------
676 >>> from xarray.namedarray.core import NamedArray
677 >>> na = NamedArray("x", np.array([1, 2, 3, 0, 2, np.nan]))
678 >>> na
679 <xarray.NamedArray (x: 6)> Size: 48B
680 array([ 1., 2., 3., 0., 2., nan])
681
682 >>> na.var()
683 <xarray.NamedArray ()> Size: 8B

Callers

nothing calls this directly

Calls 1

reduceMethod · 0.95

Tested by

no test coverage detected