# xarray.computation.rolling_exp.RollingExp.mean

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

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('94bf120d-fcb9-475a-86dd-a5474873333e','0e0cb839-43c6-49da-8b46-65b3f6e6e21d','047e4b3e-5ca7-4959-b573-05c58fb5c318','../lite/tree/../notebooks/index.html?path=b7abb9c5_97d6_4aac_af0d_c7086efed010.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="047e4b3e-5ca7-4959-b573-05c58fb5c318" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('94bf120d-fcb9-475a-86dd-a5474873333e','047e4b3e-5ca7-4959-b573-05c58fb5c318')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('94bf120d-fcb9-475a-86dd-a5474873333e','047e4b3e-5ca7-4959-b573-05c58fb5c318')">Open In Tab</button></div><div id="0e0cb839-43c6-49da-8b46-65b3f6e6e21d" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
