Using pandas and EWMA
<p>I am accustomed to exponential moving average (EMA) being calculated the <a href="http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages" rel="nofollow">following</a> way:</p>

<pre><code>SMA: 10 period sum / 10 

Multiplier: (2 / (Time periods + 1) ) = (2 / (10 + 1) ) = 0.1818 (18.18%)

EMA: {Close - EMA(previous day)} x multiplier + EMA(previous day). 
</code></pre>

<p>Yet when I run <code>pd.ewma(df['Close'])</code> I do not see the output that matches this approach.</p>

<p>The following code gives me the answer I am expecting, but takes a bit longer to run.</p>

<p>Anyone have any pointers on what is the proper way to leverage this library to give me the output I am expecting?</p>

<pre><code>import pandas.io.data as web

import datetime
import pandas as pd
start = datetime.datetime(2010, 1, 1)

end = datetime.datetime.today()
f = web.DataReader("SPY", 'yahoo', start, end)
f['sma']=pd.rolling_mean(f['Adj Close'],10)
days=10.
alpha=(2./(days+1.))
d={}

for x in f[(f['sma']&gt;0)].index:
    if len(d)==0:
        d[x] = f[(f.index==x)]['sma'].values[0]
    else:
        d[x] = (f[(f.index==x)]['Adj Close'].values[0] - d[dt_prior])*alpha + d[dt_prior]

    dt_prior = x
pd.Series(d)
</code></pre>