Resize with averaging or rebin a numpy 2d array?

Here's an example based on the answer you've linked (for clarity).

Here's an example based on the answer you've linked (for clarity): >>> import numpy as np >>> a = np. Arange(24). Reshape((4,6)) >>> a array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23) >>> a.

Reshape((2,a. Shape0//2,3,-1)). Mean(axis=3).

Mean(1) array( 3.5, 5.5, 7.5, 15.5, 17.5, 19.5) As a function: def rebin(a, shape): sh = shape0,a. Shape0//shape0,shape1,a. Shape1//shape1 return a.

Reshape(sh). Mean(-1). Mean(1).

Wow. Very elegant solution! – Simon Nov 11 at 9:02 thanks, I have created gist on github with the implementation of this function, in case somebody else needs it: gist.github.Com/1348792, I also suggested on numpy-discussion to add it to numpy but the answer was negative.

– Andrea Zonca Nov 12 at 4:05.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions