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

Method mean

xarray/core/_aggregations.py:4257–4370  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

4255 return out
4256
4257 def mean(
4258 self,
4259 dim: Dims = None,
4260 *,
4261 skipna: bool | None = None,
4262 keep_attrs: bool | None = None,
4263 **kwargs: Any,
4264 ) -> Dataset:
4265 """
4266 Reduce this Dataset's data by applying ``mean`` along some dimension(s).
4267
4268 Parameters
4269 ----------
4270 dim : str, Iterable of Hashable, "..." or None, default: None
4271 Name of dimension[s] along which to apply ``mean``. For e.g. ``dim="x"``
4272 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
4273 If "...", will reduce over all dimensions.
4274 skipna : bool or None, optional
4275 If True, skip missing values (as marked by NaN). By default, only
4276 skips missing values for float dtypes; other dtypes either do not
4277 have a sentinel missing value (int) or ``skipna=True`` has not been
4278 implemented (object, datetime64 or timedelta64).
4279 keep_attrs : bool or None, optional
4280 If True, ``attrs`` will be copied from the original
4281 object to the new one. If False, the new object will be
4282 returned without attributes.
4283 **kwargs : Any
4284 Additional keyword arguments passed on to the appropriate array
4285 function for calculating ``mean`` on this object's data.
4286 These could include dask-specific kwargs like ``split_every``.
4287
4288 Returns
4289 -------
4290 reduced : Dataset
4291 New Dataset with ``mean`` applied to its data and the
4292 indicated dimension(s) removed
4293
4294 See Also
4295 --------
4296 numpy.mean
4297 dask.array.mean
4298 Dataset.mean
4299 :ref:`groupby`
4300 User guide on groupby operations.
4301
4302 Notes
4303 -----
4304 Use the ``flox`` package to significantly speed up groupby computations,
4305 especially with dask arrays. Xarray will use flox by default if installed.
4306 Pass flox-specific keyword arguments in ``**kwargs``.
4307 See the `flox documentation <https://flox.readthedocs.io>`_ for more.
4308
4309 Examples
4310 --------
4311 >>> da = xr.DataArray(
4312 ... np.array([1, 2, 3, 0, 2, np.nan]),
4313 ... dims="time",
4314 ... coords=dict(

Callers

nothing calls this directly

Calls 3

_flox_reduceMethod · 0.95
reduceMethod · 0.95

Tested by

no test coverage detected