[Numpy-discussion] Apply a vector function to each row of a matrix

Neal Becker ndbecker2@gmail....
Thu Oct 9 08:40:06 CDT 2008


David Huard wrote:

> Neal,
> 
> Look at: apply_along_axis
> 
> 
I guess it'd be:

b = empty_like(a)
for row in a.shape[0]:
  b[row,:] = apply_along_axis (func, row, a)

I don't suppose there is a way to do this without explicitly writing a loop.



More information about the Numpy-discussion mailing list