pandas.core.window.Expanding.count — pandas 0.24.0rc1 documentation (original) (raw)

The expanding count of any non-NaN observations inside the window.

s = pd.Series([2, 3, np.nan, 10]) s.rolling(2).count() 0 1.0 1 2.0 2 1.0 3 1.0 dtype: float64 s.rolling(3).count() 0 1.0 1 2.0 2 2.0 3 2.0 dtype: float64 s.rolling(4).count() 0 1.0 1 2.0 2 2.0 3 3.0 dtype: float64