DataFrame.ewm(com=None, span=None, halflife=None, alpha=None, min_periods=0, adjust=True, ignore_na=False, axis=0)
[source]
Provides exponential weighted functions
New in version 0.18.0.
Parameters: 
com : float, optional Specify decay in terms of center of mass, \(\alpha = 1 / (1 + com),\text{ for } com \geq 0\) span : float, optional Specify decay in terms of span, \(\alpha = 2 / (span + 1),\text{ for } span \geq 1\) halflife : float, optional Specify decay in terms of halflife, \(\alpha = 1  exp(log(0.5) / halflife),\text{ for } halflife > 0\) alpha : float, optional Specify smoothing factor \(\alpha\) directly, \(0 < \alpha \leq 1\) New in version 0.18.0. min_periods : int, default 0 Minimum number of observations in window required to have a value (otherwise result is NA). adjust : boolean, default True Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings (viewing EWMA as a moving average) ignore_na : boolean, default False Ignore missing values when calculating weights; specify True to reproduce pre0.15.0 behavior 

Returns: 

Exactly one of center of mass, span, halflife, and alpha must be provided. Allowed values and relationship between the parameters are specified in the parameter descriptions above; see the link at the end of this section for a detailed explanation.
When adjust is True (default), weighted averages are calculated using weights (1alpha)**(n1), (1alpha)**(n2), …, 1alpha, 1.
When ignore_na is False (default), weights are based on absolute positions. For example, the weights of x and y used in calculating the final weighted average of [x, None, y] are (1alpha)**2 and 1 (if adjust is True), and (1alpha)**2 and alpha (if adjust is False).
When ignore_na is True (reproducing pre0.15.0 behavior), weights are based on relative positions. For example, the weights of x and y used in calculating the final weighted average of [x, None, y] are 1alpha and 1 (if adjust is True), and 1alpha and alpha (if adjust is False).
More details can be found at http://pandas.pydata.org/pandasdocs/stable/computation.html#exponentiallyweightedwindows
>>> df = DataFrame({'B': [0, 1, 2, np.nan, 4]}) B 0 0.0 1 1.0 2 2.0 3 NaN 4 4.0
>>> df.ewm(com=0.5).mean() B 0 0.000000 1 0.750000 2 1.615385 3 1.615385 4 3.670213
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3clause BSD License.
http://pandas.pydata.org/pandasdocs/version/0.23.4/generated/pandas.DataFrame.ewm.html