python - Decrease array size by averaging adjacent values with numpy -



python - Decrease array size by averaging adjacent values with numpy -

i have big array of thousands of vals in numpy. want decrease size averaging adjacent values. example:

a = [2,3,4,8,9,10] #average downwards 2 values here = [3,9] #it averaged 2,3,4 , 8,9,10

so, basically, have n number of elements in array, , want tell average downwards x number of values, , averages above.

is there way numpy (already using other things, i'd stick it).

as mentioned in comments, want probably:

group = 3 = a.reshape(-1, group).mean(axis=1)

python arrays numpy mean

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -