Group average of a numpy array?
<p>I have a large numpy array, with dimensions <code>[1]</code>. I want to find out a sort of "group average". More specifically,</p>

<p>Let my array be <code>[1,2,3,4,5,6,7,8,9,10]</code> and let my <code>group_size</code> be <code>3</code>. Hence, I will average the first three elements, the 4th to 6th element, the 7th to 9th element, and average the remaining elements (only 1 in this case to get - <code>[2, 5, 8, 10]</code>. Needless to say, I need a vectorized implementation.</p>

<p>Finally, my purpose is reducing the number of points in a noisy graph to smoothen out a general pattern having a lot of oscillation. Is there a <strong>correct</strong> way to do this? I would like the answer to both questions, in case they have a different answer. Thanks!</p>