# 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('d2766357-7782-4bb1-bf65-05ea07d63b06','8e980306-596d-4d72-ba62-9d3d1657cca7','9db14501-7d15-452c-b87f-f13a24cb4f2b','../lite/tree/../notebooks/index.html?path=fc94ba2f_106e_4b59_adde_18f02fa79ed2.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="9db14501-7d15-452c-b87f-f13a24cb4f2b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('d2766357-7782-4bb1-bf65-05ea07d63b06','9db14501-7d15-452c-b87f-f13a24cb4f2b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('d2766357-7782-4bb1-bf65-05ea07d63b06','9db14501-7d15-452c-b87f-f13a24cb4f2b')">Open In Tab</button></div><div id="8e980306-596d-4d72-ba62-9d3d1657cca7" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
