[Numpy-discussion] Medians that ignore values
Charles R Harris
charlesr.harris@gmail....
Thu Sep 18 13:23:34 CDT 2008
On Thu, Sep 18, 2008 at 11:31 AM, Peter Saffrey <pzs@dcs.gla.ac.uk> wrote:
> Pierre GM <pgmdevlist <at> gmail.com> writes:
>
> > Mmh, typo?
> >
>
> Yes, apologies. I was aiming for thorough, but ended up just careless. It's
> been
> a long day.
>
> > Ohoh. What version of numpy are you using ?
>
> The version in the Ubuntu package repository. It says 1:1.0.4-6ubuntu3.
>
> > if you don't give an axis
> > parameter, you should get the median of the flattened array, therefore a
> > scalar, not an array.
>
> Not for my version.
>
> >>> a = rand(10,3)
> >>> a
> array([[ 0.1269796 , 0.43003978, 0.4700416 ],
> [ 0.28867077, 0.85265318, 0.35908364],
> [ 0.72967127, 0.41856028, 0.54724918],
> [ 0.28821876, 0.69684144, 0.54647616],
> [ 0.09592476, 0.83704808, 0.52425368],
> [ 0.743552 , 0.44433314, 0.7362179 ],
> [ 0.4283931 , 0.13305385, 0.68422292],
> [ 0.68860674, 0.15057373, 0.99206493],
> [ 0.31846329, 0.77237046, 0.986883 ],
> [ 0.4578616 , 0.4580833 , 0.97754176]])
> >>> median(a.T)
> array([ 0.43003978, 0.35908364, 0.54724918, 0.54647616, 0.52425368,
> 0.7362179 , 0.4283931 , 0.68860674, 0.77237046, 0.4580833 ])
>
> > Anyway: you should use ma.median for masked arrays. Else, you're just
> keeping
> > the NaNs where they were.
> >
>
> That will be the problem. My version does not have median or mean methods
> for
> masked arrays, only the average() method.
>
> According to this page:
>
> http://www.scipy.org/Download
>
> 1.1.0 is the latest release. Do I need to use an SVN build to get the
> ma.median
> functionality?
>
1.1.1 is the latest release and 1.2 is coming out shortly.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080918/ced3f5c0/attachment.html
More information about the Numpy-discussion
mailing list