# xarray.IndexVariable.reduce

#### IndexVariable.reduce(func, dim=None, axis=None, keep_attrs=None, keepdims=False, \*\*kwargs)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/variable.py#L1969-L2025)

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

* **Parameters:**
  * **func** ([`callable()`](https://docs.python.org/3/builtins/functions.html#callable)) – Function which can be called in the form
    func(x, axis=axis, \*\*kwargs) to return the result of reducing an
    np.ndarray over an integer valued axis.
  * **dim** (`"..."`, [`str`](https://docs.python.org/3/builtins/stdtypes.html#str), `Iterable` of `Hashable` or [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – Dimension(s) over which to apply func. By default func is
    applied over all dimensions.
  * **axis** ([`int`](https://docs.python.org/3/builtins/functions.html#int) or `Sequence` of [`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Axis(es) over which to apply func. Only one of the ‘dim’
    and ‘axis’ arguments can be supplied. If neither are supplied, then
    the reduction is calculated over the flattened array (by calling
    func(x) without an axis argument).
  * **keep_attrs** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*) – If True (default), the variable’s attributes (attrs) will be copied from
    the original object to the new one.  If False, the new
    object will be returned without attributes.
  * **keepdims** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – If True, the dimensions which are reduced are left in the result
    as dimensions of size one
  * **\*\*kwargs** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)) – Additional keyword arguments passed on to func.
* **Returns:**
  **reduced** (`Array`) – Array with summarized data and the indicated dimension(s)
  removed.
