Dataset.reduce(self, func: Callable, dim: Union[Hashable, Iterable[Hashable]] = None, keep_attrs: bool = None, keepdims: bool = False, numeric_only: bool = False, allow_lazy: bool = False, **kwargs: Any) → 'Dataset'

Reduce this dataset by applying func along some dimension(s).

  • func (callable) – Function which can be called in the form f(x, axis=axis, **kwargs) to return the result of reducing an np.ndarray over an integer valued axis.

  • dim (str or sequence of str, optional) – Dimension(s) over which to apply func. By default func is applied over all dimensions.

  • keep_attrs (bool, optional) – If True, the dataset’s attributes (attrs) will be copied from the original object to the new one. If False (default), the new object will be returned without attributes.

  • keepdims (bool, default False) – If True, the dimensions which are reduced are left in the result as dimensions of size one. Coordinates that use these dimensions are removed.

  • numeric_only (bool, optional) – If True, only apply func to variables with a numeric dtype.

  • **kwargs (Any) – Additional keyword arguments passed on to func.


reduced – Dataset with this object’s DataArrays replaced with new DataArrays of summarized data and the indicated dimension(s) removed.

Return type