You are viewing documentation about an older version (1.22.1). View latest version

modin.pandas.Rolling.countΒΆ

Rolling.count(numeric_only: bool = False)[source]ΒΆ

Compute the rolling count.

Parameters:
  • numeric_only (bool, default False) – Include only float, int, boolean columns.

  • *args (tuple) – Positional arguments to pass to func.

  • **kwargs (dict) – Keyword arguments to be passed into func.

Returns:

Computed rolling count of values.

Return type:

Series or DataFrame

Examples

>>> df = pd.DataFrame({'B': [0, 1, 2, np.nan, 4]})
>>> df
     B
0  0.0
1  1.0
2  2.0
3  NaN
4  4.0
>>> df.rolling(2, min_periods=1).count()
   B
0  1
1  2
2  2
3  1
4  1
>>> df.rolling(2, min_periods=2).count()
     B
0  NaN
1  2.0
2  2.0
3  1.0
4  1.0
>>> df.rolling(3, min_periods=1, center=True).count()
   B
0  2
1  3
2  2
3  2
4  1
Copy