def foo(df):

    def inner_foo(x):
        window = df.iloc[x]
c = df.ix[int(x[-1]), 'c']
dvals = window['a'] + window['b'] * c
return bar(dvals)
return inner_foo
df['e'] = pd.rolling_apply(np.arange(len(df)), 6, foo(df))
Rolling a function on a data frame