[Numpy-discussion] median object

keflavich keflavich@gmail....
Mon Jul 6 18:00:41 CDT 2009


Hi, I want to be able to do something like:

import numpy
x=numpy.array([1,4,4,6,7,3,4,2])
x.median()

rather than
numpy.median(x)

so that in a function, I can call
x.median()
and allow x to be a masked array or a numpy array.

Using the ma.median version by default is something of a workaround, because
it appears to work on both numpy arrays and masked arrays.  My question,
though, is: why is median() not implemented as an attribute of the
array/masked array object, while min/max/mean/std are?  Is there a better
workaround?

Thanks,
Adam
-- 
View this message in context: http://www.nabble.com/median-object-tp24364327p24364327.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.



More information about the NumPy-Discussion mailing list