xorbits.pandas.window.Rolling.count#

Rolling.count(*args, **kwargs)[源代码]#

Calculate the rolling count of non NaN observations.

参数

numeric_only (bool, default False (Not supported yet)) –

Include only float, int, boolean columns.

1.5.0(pandas) 新版功能.

返回

Return type is the same as the original object with np.float64 dtype.

返回类型

Series or DataFrame

参见

pandas.Series.rolling

Calling rolling with Series data.

pandas.DataFrame.rolling

Calling rolling with DataFrames.

pandas.Series.count

Aggregating count for Series.

pandas.DataFrame.count

Aggregating count for DataFrame.

实际案例

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

This docstring was copied from pandas.core.window.rolling.Rolling.