import numpy as np
from pandas import Series, date_range, rolling_count, rolling_sum, rolling_apply
ts = Series(np.ones(4), index=date_range('2012-10-1', '2012-10-4'))
ts
rolling_count(ts, 3)
rolling_sum(ts, 3)
def f(_):
print _
return sum(_) % 2 == 0
rolling_apply(ts, 3, f)