# 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('171e6546-5553-4298-b96f-d31d7e1ad5cb','b8d30257-6175-45c0-b92e-b21a1c4a36fa','c17190af-49c4-4c48-9e09-8414ddacdcb9','../lite/tree/../notebooks/index.html?path=c58aed59_d438_4ee6_a3d9_f6e2a59ab1ba.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="c17190af-49c4-4c48-9e09-8414ddacdcb9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('171e6546-5553-4298-b96f-d31d7e1ad5cb','c17190af-49c4-4c48-9e09-8414ddacdcb9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('171e6546-5553-4298-b96f-d31d7e1ad5cb','c17190af-49c4-4c48-9e09-8414ddacdcb9')">Open In Tab</button></div><div id="b8d30257-6175-45c0-b92e-b21a1c4a36fa" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
