Reduce this DataArray'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=[
(
self,
dim: Dims = None,
*,
skipna: bool | None = None,
keep_attrs: bool | None = None,
**kwargs: Any,
)
| 7304 | return out |
| 7305 | |
| 7306 | def mean( |
| 7307 | self, |
| 7308 | dim: Dims = None, |
| 7309 | *, |
| 7310 | skipna: bool | None = None, |
| 7311 | keep_attrs: bool | None = None, |
| 7312 | **kwargs: Any, |
| 7313 | ) -> DataArray: |
| 7314 | """ |
| 7315 | Reduce this DataArray's data by applying ``mean`` along some dimension(s). |
| 7316 | |
| 7317 | Parameters |
| 7318 | ---------- |
| 7319 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 7320 | Name of dimension[s] along which to apply ``mean``. For e.g. ``dim="x"`` |
| 7321 | or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions. |
| 7322 | If "...", will reduce over all dimensions. |
| 7323 | skipna : bool or None, optional |
| 7324 | If True, skip missing values (as marked by NaN). By default, only |
| 7325 | skips missing values for float dtypes; other dtypes either do not |
| 7326 | have a sentinel missing value (int) or ``skipna=True`` has not been |
| 7327 | implemented (object, datetime64 or timedelta64). |
| 7328 | keep_attrs : bool or None, optional |
| 7329 | If True, ``attrs`` will be copied from the original |
| 7330 | object to the new one. If False, the new object will be |
| 7331 | returned without attributes. |
| 7332 | **kwargs : Any |
| 7333 | Additional keyword arguments passed on to the appropriate array |
| 7334 | function for calculating ``mean`` on this object's data. |
| 7335 | These could include dask-specific kwargs like ``split_every``. |
| 7336 | |
| 7337 | Returns |
| 7338 | ------- |
| 7339 | reduced : DataArray |
| 7340 | New DataArray with ``mean`` applied to its data and the |
| 7341 | indicated dimension(s) removed |
| 7342 | |
| 7343 | See Also |
| 7344 | -------- |
| 7345 | numpy.mean |
| 7346 | dask.array.mean |
| 7347 | DataArray.mean |
| 7348 | :ref:`groupby` |
| 7349 | User guide on groupby operations. |
| 7350 | |
| 7351 | Notes |
| 7352 | ----- |
| 7353 | Use the ``flox`` package to significantly speed up groupby computations, |
| 7354 | especially with dask arrays. Xarray will use flox by default if installed. |
| 7355 | Pass flox-specific keyword arguments in ``**kwargs``. |
| 7356 | See the `flox documentation <https://flox.readthedocs.io>`_ for more. |
| 7357 | |
| 7358 | Examples |
| 7359 | -------- |
| 7360 | >>> da = xr.DataArray( |
| 7361 | ... np.array([1, 2, 3, 0, 2, np.nan]), |
| 7362 | ... dims="time", |
| 7363 | ... coords=dict( |
nothing calls this directly
no test coverage detected