snowflake.snowpark.modin.plugin.extensions.window_overrides.Rolling.count

Rolling.count(numeric_only: bool = False)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/window_overrides.py#L202-L204)

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
Language: English