[Numpy-discussion] howto apply-along-axis?

Neal Becker ndbecker2 at gmail.com
Fri Mar 22 09:59:52 EDT 2013


I frequently find I have my 1d function that performs some reduction that I'd 
like to apply-along some axis of an n-d array.

As a trivial example, 

def sum(u):
  return np.sum (u)

In this case the function is probably C/C++ code, but that is irrelevant (I 
think).

Is there a reasonably efficient way to do this within numpy?




More information about the NumPy-Discussion mailing list