Rolling

class Sloth.rolling.Rolling

Rolling window calculations on a DataFrame.

Parameters

frameFrame

The DataFrame on which to perform rolling calculations.

windowint

The size of the moving window.

Attributes

frameFrame

The DataFrame to perform operations on.

windowint

The window size for rolling calculations.

Examples

>>> import numpy as np
>>> from frame import Frame, DataFrame
>>> data = np.random.randn(10, 3)
>>> index = list(range(10))
>>> columns = ['A', 'B', 'C']
>>> df = DataFrame(values=data, index=index, columns=columns)
>>> rolling = Rolling(df, window=3)
>>> # Calculate rolling mean
>>> rolling.mean()
>>> # Calculate rolling sum
>>> rolling.sum()

Methods