title: Pandas: rolling std deviation/mean by trading days
body: <p>I am trying to extract the rolling std deviation and mean on trading data by using <code>rolling_*</code> functions of <code>pandas</code>. </p>
  
  <p>My data looks like:</p>
  
  <pre><code>Tick   Trading_day  Trade_price  
  
  VOD     2013-1-2     30.23
  VOD     2013-1-2     30.33
  VOD     2013-1-2     30.24
  VOD     2013-1-5     31.23
  VOD     2013-1-5     30.23
  VOD     2013-1-6     30.23
  VOD     2013-1-7     30.23
  VOD     2013-1-8     30.23
  VOD     2013-1-9     30.23
  
  ...     .......      .....
  
  RBS     2013-1-2     15.23
  ...     .......      .....
  </code></pre>
  
  <p>Basically, I want to work out mean price and standard deviation of price by <strong>each stock</strong> based on  <strong>(-3, +3) trading days</strong>.</p>
  
  <p>Please note there are two <strong>tricky things</strong> here:</p>
  
  <ol>
  <li><p><strong>There are various number of trades</strong> in each trading day (frequent trades in liquid day).</p></li>
  <li><p>Those are trading days (<strong>not calendar days</strong>), therefore they are not in sequence.</p></li>
  </ol>
  
  <p>My ideal output is </p>
  
  <pre><code>Tick   Trading_day  mean_price   std_price  
  
  VOD     2013-1-2     30.23         0.13
  VOD     2013-1-5     30.11         0.09
  VOD     2013-1-6     30.24         0.15
  ...     .....        .......      .....
  RBS     2013-1-2     15.23         0.19
  </code></pre>
  
  <p>Anyone has idea ? Thanks in advance !</p>