title: Python Pandas: Calculate moving average within group
body: <p>I have a dataframe containing time series for 100 objects:</p>
  
  <pre><code>object  period  value 
  1       1       24
  1       2       67
  ...
  1       1000    56
  2       1       59
  2       2       46
  ...
  2       1000    64
  3       1       54
  ...
  100     1       451
  100     2       153
  ...
  100     1000    21
  </code></pre>
  
  <p>I want to calculate moving average with window 10 for the <code>value</code> column. I guess I have to do something like</p>
  
  <pre><code>df.groupby('object').apply(lambda ~calculate MA~) 
  </code></pre>
  
  <p>and then merge this Series to the original dataframe by object? Can't figure out exact commands</p>