If you want to find the average of the previous n data points (simple moving average) with pandas, use df.rolling(time_period).mean().
df.rolling(time_period).mean()
The code above shows how to find the simple moving average of the previous 3 data-points.