Moving average of a list of lists in python
I have an large array, but with similar structure to:
[[ 0 1 2 3 4]
[ 5 6 7 8 9]
[10 11 12 13 14]
[15 16 17 18 19]]
What would be the best , most efficient way of taking the rolling average
of 5 elements without flattening the array. i.e.
value one would be (0+1+2+3+4)/5=2
value two would be (1+2+3+4+5)/5=3
value three would be (2+3+4+5+6)/5=4
Thanks
No comments:
Post a Comment