Rolling Agg

Row-based; Calculates a rolling aggregate based on a relative row window.

Pass in order_by columns and offsets to create a row-based look-back or look-forward windows.

Example use case: Aggregate the last 10 sales for a customer regardless of when they occurred.

Parameters

Example

internet_sales = rasgo.get.dataset(74)

ds = internet_sales.rolling_agg(
      aggregations={
        'SALESAMOUNT':['MAX', 'MIN', 'SUM']
      },
      order_by=['ORDERDATE'],
      offsets=[-7, 7, 14],
      group_by=['PRODUCTKEY'],
  )

Source Code

Last updated