rolling_operator

Rolling Operator

class tasrif.processing_pipeline.pandas.rolling_operator.RollingOperator(winsize, selector=None, **kwargs)

Examples

>>> import pandas as pd
>>> import numpy as np
>>> from tasrif.processing_pipeline.pandas import RollingOperator
>>>
>>>
>>> df = pd.DataFrame({'B': [0, 1, 2, 3, 4]})
>>>
>>> op = RollingOperator(2)
>>> op.process(df)[0].sum()
.   B
0   NaN
1   1.0
2   3.0
3   5.0
4   7.0
__init__(winsize, selector=None, **kwargs)

Creates a new instance of RollingOperator

Parameters
  • winsize (int) – offset or BaseIndexer subclass

  • selector – select the columns of a groupby object

  • **kwargs – Arguments to pandas pd.groupby function