title: Python - calculate weighted rolling standard deviation
body: <p>I have minute by minute a panda dataframe df. I'm looking to apply weighting to Return and compute a rolling weighted standard deviation, with window = 10. I can calculate non-weighted std, annualized with:</p>
  
  <pre><code>df_spy['10mVol'] = df_spy['Return'].rolling(center=False,window=10).std()*(1440*252)**(0.5)*100
  </code></pre>
  
  <p>There is another question asking for weighted std in Numpy, but i'm curious on the rolling weighted stdev. (<a href="https://stackoverflow.com/questions/2413522/weighted-standard-deviation-in-numpy?rq=1">Weighted standard deviation in NumPy?</a>)</p>
  
  <p>The formula for calculating weighted standard deviation is:
  <a href="https://math.stackexchange.com/questions/320441/standard-deviation-of-the-weighted-mean">https://math.stackexchange.com/questions/320441/standard-deviation-of-the-weighted-mean</a></p>
  
  <pre><code>weighting   Midpoint   Return      10mVol   Weighted
  0.2         215.6700    NaN         NaN      NaN
  0.8         215.8400    -0.000788   NaN     -0.000630
  0.8         216.0600    -0.001019   NaN     -0.000815
  </code></pre>
  
  <p>Thanks for helping</p>