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

Delphi change the assembly code of a running process -

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

C++ 11 "class" keyword -