ENH: window functions need to exclude nuiscance columns · Issue #12537 · pandas-dev/pandas (original) (raw)

xref example in : #13327

In [4]: df = DataFrame({'A' : pd.date_range('20130101',periods=3),'B' : range(3)})

In [5]: df
Out[5]: 
           A  B
0 2013-01-01  0
1 2013-01-02  1
2 2013-01-03  2

This is a supported op

In [7]: df.rolling(window=2).count()
Out[7]: 
     A    B
0  1.0  1.0
1  2.0  2.0
2  2.0  2.0

This works

In [9]: df.rolling(window=2).B.sum()
Out[9]: 
0    NaN
1    1.0
2    3.0
Name: B, dtype: float64
df.rolling(window=2).sum()

should work (but excluded A) from the results.