def myrolling_apply(df, N, f, nn=1):
    ii = [int(x) for x in arange(0, df.shape[0] - N + 1, nn)]
out = [f(df.iloc[i:i + N]) for i in ii]
out = pandas.Series(out)
out.index = df.index[N - 1::nn]
Using rolling_apply on a DataFrame object