[SciPy-user] scoreatpercentile on 2D array gives unexpected result

Stefan van der Walt stefan at sun.ac.za
Thu Sep 20 16:15:52 EDT 2007


Hi Vincent

On Tue, Sep 11, 2007 at 03:00:28AM -0000, Vincent wrote:
> I want to get certain percentiles of each column of an array (i.e.,
> 2.5th, 50th, and 97.5th).
> 
> Testing the scipy scoreatpercentile function i get some results I
> didn't expect.
> 
> In [5]: z
> Out[5]:
> array([[1, 1, 1],
>        [1, 1, 1],
>        [4, 4, 3],
>        [1, 1, 1],
>        [1, 1, 1]])
> 
> The following works as expected:
> 
> In [6]: N.median(z)
> Out[6]: array([1, 1, 1])
> 
> Now using scoreatpercentile:
> 
> In [54]: scipy.stats.scoreatpercentile(z,50)
> Out[54]: array([3, 4, 4])

This should be fixed in SVN r3341.

Cheers
Stéfan



More information about the SciPy-User mailing list