title: Pandas - calculate rolling average of group excluding current row
body: <p>For an example: </p>
  
  <pre><code>data = {'Platoon': ['A','A','A','A','A','A','B','B','B','B','B','C','C','C','C','C'],
          'Date' : [1,2,3,4,5,6,1,2,3,4,5,1,2,3,4,5],
         'Casualties': [1,4,5,7,5,5,6,1,4,5,6,7,4,6,4,6]}
  df = pd.DataFrame(data)
  </code></pre>
  
  <p>This works to calculate the rolling average, inclusive of the current row: </p>
  
  <pre><code>df['avg'] = df.groupby(['Platoon'])['Casualties'].transform(lambda x: x.rolling(2, 1).mean())
  </code></pre>
  
  <p>Which gives: </p>
  
  <pre><code>Platoon   Date Casualties Avg  
          A   1   1         1.0
          A   2   4         2.5
          A   3   5         4.5
          A   4   7         6.0
          ......
  </code></pre>
  
  <p>What I want to get is:</p>
  
  <pre><code>Platoon   Date Casualties Avg  
          A   1   1         1.0
          A   2   4         1.0
          A   3   5         2.5
          A   4   7         4.5
          ......
  </code></pre>
  
  <p>I suspect I can use shift here but I can't figure it out!</p>