Hi

I want to apply a function (myfunc which takes and returns a scalar) to each
element in a multi-dimensioned array (data):

I can do this:

newdata = numpy.array([myfunc(d) for d in data.flat]).reshape(data.shape)

But I'm wondering if there's a faster more numpy way. I've looked at the
vectorize function but can't work it out.

thanks Eleanor
-- 
View this message in context: 
http://www.nabble.com/Apply-a-function-to-an-array-elementwise-tp20823768p20823768.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to