modin.pandas.Rolling.sumΒΆ
- Rolling.sum(numeric_only: bool = False, *args: Any, engine: Optional[Literal['cython', 'numba']] = None, engine_kwargs: Optional[dict[str, bool]] = None, **kwargs: Any)[source]ΒΆ
Compute the rolling sum.
- Parameters:
numeric_only (bool, default False) β Include only float, int, boolean columns.
*args (tuple) β Positional arguments to pass to func.
engine (str, default None None) β
'cython'
: Runs the operation through C-extensions from cython.'numba'
: Runs the operation through JIT compiled code from numba.None
: Defaults to'cython'
or globally settingcompute.use_numba
This parameter is ignored in Snowpark pandas. The execution engine will always be Snowflake.
engine_kwargs (dict, default None None) β
For
'cython'
engine, there are no acceptedengine_kwargs
- For
'numba'
engine, the engine can acceptnopython
,nogil
and
parallel
dictionary keys. The values must either beTrue
orFalse
. The defaultengine_kwargs
for the'numba'
engine is{'nopython': True, 'nogil': False, 'parallel': False}
.
- For
This parameter is ignored in Snowpark pandas. The execution engine will always be Snowflake.
**kwargs (dict) β Keyword arguments to be passed into func.
- Returns:
Computed rolling sum of values.
- Return type:
Series
orDataFrame
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).sum() B 0 0.0 1 1.0 2 3.0 3 2.0 4 4.0 >>> df.rolling(2, min_periods=2).sum() B 0 NaN 1 1.0 2 3.0 3 NaN 4 NaN >>> df.rolling(3, min_periods=1, center=True).sum() B 0 1.0 1 3.0 2 3.0 3 6.0 4 4.0