# xarray.computation.rolling_exp.RollingExp.sum

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

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('71dc4602-c3dc-47b4-889e-bdc48485e526','fbacf242-ddf1-4ae6-9c08-5048c454c216','9f454901-8218-424d-9fb0-0fb23e9c3b95','../lite/tree/../notebooks/index.html?path=db826f6a_8e24_4971_8fbe_b62c8c8054b0.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="9f454901-8218-424d-9fb0-0fb23e9c3b95" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('71dc4602-c3dc-47b4-889e-bdc48485e526','9f454901-8218-424d-9fb0-0fb23e9c3b95')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('71dc4602-c3dc-47b4-889e-bdc48485e526','9f454901-8218-424d-9fb0-0fb23e9c3b95')">Open In Tab</button></div><div id="fbacf242-ddf1-4ae6-9c08-5048c454c216" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
