rolling mean with increasing window
<p>I have a range</p>

<pre><code>np.arange(1,11) # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
</code></pre>

<p>and for each element, <em>i</em>, in my range I want to compute the average from element <em>i=0</em> to my current element. the result would be something like:</p>

<pre><code>array([ 1. ,  1.5,  2. ,  2.5,  3. ,  3.5,  4. ,  4.5,  5. ,  5.5])
 # got this result via np.cumsum(np.arange(1,11,dtype=np.float32))/(np.arange(1, 11))
</code></pre>

<p>I was wondering if there isn't an out of the box function in numpy / pandas that gives me this result?</p>

<p>This seems to be the simplest, although it may become inefficient if <em>x</em> is very large:</p>

<pre><code>x = range(1,11)
[np.mean(x[:i+1]) for i in xrange(0,len(x))]
</code></pre>

python pandas numpy