pandas.core.window.rolling.Rolling.count#

Rolling.count()[源代码]#

计算非NaN观测的滚动计数。

退货
系列或DataFrame

返回类型与原始对象相同, np.float64 数据类型。

参见

pandas.Series.rolling

使用系列数据进行呼叫滚动。

pandas.DataFrame.rolling

使用DataFrames调用滚动。

pandas.Series.count

系列的聚合计数。

pandas.DataFrame.count

DataFrame的聚合计数。

示例

>>> 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