# xarray.computation.rolling_exp.RollingExp.mean

#### RollingExp.mean(keep_attrs=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/computation/rolling_exp.py#L97-L133)

Exponentially weighted moving average.

* **Parameters:**
  **keep_attrs** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`None`](https://docs.python.org/3/builtins/constants.html#None)) – If True, the attributes (`attrs`) will be copied from the original
  object to the new one. If False, the new object will be returned
  without attributes. If None uses the global default.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('6501e5b4-aa63-4525-ac8b-1f00d2a4da91','4b4e7867-6766-4941-89d9-6e84a6973366','11162203-f220-48d6-9fe6-25c488aaa68e','../lite/tree/../notebooks/index.html?path=4acbda54_bb2a_4ab2_ad14_3d1f3d44cb6e.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray([1, 1, 2, 2, 2], dims="x")
>>> da.rolling_exp(x=2, window_type="span").mean()
<xarray.DataArray (x: 5)> Size: 40B
array([1.        , 1.        , 1.69230769, 1.9       , 1.96694215])
Dimensions without coordinates: x
```

<div id="11162203-f220-48d6-9fe6-25c488aaa68e" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('6501e5b4-aa63-4525-ac8b-1f00d2a4da91','11162203-f220-48d6-9fe6-25c488aaa68e')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('6501e5b4-aa63-4525-ac8b-1f00d2a4da91','11162203-f220-48d6-9fe6-25c488aaa68e')">Open In Tab</button></div><div id="4b4e7867-6766-4941-89d9-6e84a6973366" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
