# xarray.computation.rolling_exp.RollingExp.sum

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

Exponentially weighted moving sum.

* **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('52393e91-f346-42dc-ab1a-97362d3b914e','c11099f2-7d34-4036-bb3c-f5b5182b4a0e','6dd05250-32d1-4ff1-be62-8d4d82cc167b','../lite/tree/../notebooks/index.html?path=53d72f2b_fb1b_461c_b79d_209dadaf94a8.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").sum()
<xarray.DataArray (x: 5)> Size: 40B
array([1.        , 1.33333333, 2.44444444, 2.81481481, 2.9382716 ])
Dimensions without coordinates: x
```

<div id="6dd05250-32d1-4ff1-be62-8d4d82cc167b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('52393e91-f346-42dc-ab1a-97362d3b914e','6dd05250-32d1-4ff1-be62-8d4d82cc167b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('52393e91-f346-42dc-ab1a-97362d3b914e','6dd05250-32d1-4ff1-be62-8d4d82cc167b')">Open In Tab</button></div><div id="c11099f2-7d34-4036-bb3c-f5b5182b4a0e" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
