I have a large numpy array, with dimensions [1]
. I want to find out a sort of "group average". More specifically,
Let my array be [1,2,3,4,5,6,7,8,9,10]
and let my group_size
be 3
. 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 - [2, 5, 8, 10]
. Needless to say, I need a vectorized implementation.
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 correct way to do this? I would like the answer to both questions, in case they have a different answer. Thanks!