pandas ewm and rolling methods to not fill in NAs
<p>Is there a parameter for ewm and rolling methods to not fill in the NAs?</p>

<pre><code>&gt;&gt;&gt; A = pd.Series([1,2,3,4,np.nan,5,6])
&gt;&gt;&gt; A
0    1.0
1    2.0
2    3.0
3    4.0
4    NaN
5    5.0
6    6.0
dtype: float64
&gt;&gt;&gt; eA = A.ewm(alpha = 0.5, ignore_na=True).mean()
&gt;&gt;&gt; eA
0    1.000000
1    1.666667
2    2.428571
3    3.266667
4    3.266667 # I want this to be NA, don't fill in
5    4.161290
6    5.095238
dtype: float64
</code></pre>

<p>Of course this is easily solved by </p>

<pre><code>eA[A.isnull()] = np.nan
</code></pre>

<p>But this takes some unnecessary running time, and the need to think of a variable name for every rolling function is bothersome when you have more than a few.</p>

<p>Unfortunately this currently isn't supported in <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.ewm.html#pandas.Series.ewm" rel="nofollow"><code>ewm</code></a>, you'd have to overwrite with <code>NaN</code> using your proposed method or filter our the <code>NaN</code> rows so that <code>ewm</code> produces a <code>Series</code> preserving the original index, you can then either use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.combine_first.html" rel="nofollow"><code>combine_first</code></a> or <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.reindex.html" rel="nofollow"><code>reindex</code></a> to re-insert the <code>NaN</code> rows:</p>

<pre><code>In [32]:
A = pd.Series([1,2,3,4,np.nan,5,6])
eA = A[A.notnull()].ewm(alpha = 0.5, ignore_na=True).mean()
eA.combine_first(A)

Out[32]:
0    1.000000
1    1.666667
2    2.428571
3    3.266667
4         NaN
5    4.161290
6    5.095238
dtype: float64

In [33]:
eA.reindex(A.index)

Out[33]:
0    1.000000
1    1.666667
2    2.428571
3    3.266667
4         NaN
5    4.161290
6    5.095238
dtype: float64
</code></pre>

python pandas