Introduction to Computational Analysis




Pay Notebook Creator: Roy Hyunjin Han0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [50]:
import numpy as np
from pandas import Series, date_range, rolling_count, rolling_sum, rolling_apply
In [51]:
ts = Series(np.ones(4), index=date_range('2012-10-1', '2012-10-4'))
ts
In [52]:
rolling_count(ts, 3)
In [53]:
rolling_sum(ts, 3)
In [54]:
def f(_):
    print _
    return sum(_) % 2 == 0

rolling_apply(ts, 3, f)