title: Calculating Lagged data in data frame
body: <p>Consider in a data frame I have the following values:</p>
  
  <pre><code>Date,Value
  2017-01-01,1
  2017-01-02,2
  2017-01-03,3
  2017-01-04,3
  2017-01-05,2
  2017-01-06,2
  ...
  2017-01-31,30
  </code></pre>
  
  <p>So after reading them to a data frame, I would like to create a dataframe with the 5-day lagged average. That means for <code>2017-01-05</code> the reading is 2.2 and for <code>2017-01-06</code> the reading is 2.4. Other than looping, is there an easier way to do so? Let's say</p>
  
  <pre><code>df = pd.DataFrame.from_csv("data.csv")
  for i in range(4, len(df)-5):
      sum_df = df[i:i+4]
      ...
  </code></pre>