import pandas as pd
import numpy as np
from numpy.lib.stride_tricks import as_strided as stride
v = df.values
n, m = v.shape
s1, s2 = v.strides
pd.DataFrame(np.nanmean(stride(v, (n - 9, 10, m), (s1, s1, s2)), 1).round(),
    df.index[9:], df.columns)
How to calculate previous n days mean using pandas?