# [Scipy-tickets] [SciPy] #1653: scoreatprecentile return wrong values when used on array with NaNs

SciPy Trac scipy-tickets@scipy....
Wed May 2 14:17:08 CDT 2012

```#1653: scoreatprecentile return wrong values when used on array with NaNs
-------------------------+--------------------------------------------------
Reporter:  imrisofer    |       Owner:  somebody
Type:  defect       |      Status:  new
Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.10.0
Keywords:               |
-------------------------+--------------------------------------------------
the output of scoreatprecentile changed according to the number of
Not-a-Numbers in the array

{{{
#create arrays
#all of the arrays have the same precentiles
a1 = array([1,2,3,4])
a2 = array([1,2,3,4,nan])
a3 = array([1,2,3,4,nan,nan])

#put all arrays in one list
l = [a1, a2, a3]

#check precentiles of each array
for i in range(3):
print "array with %d NaNs" %(i)
print "q25: ", scoreatpercentile(l[i], 25)
print "q50: ", scoreatpercentile(l[i], 50)
print "q75: ", scoreatpercentile(l[i], 75)
print
}}}

output:

{{{
array with 0 NaNs
q25:  1.75
q50:  2.5
q75:  3.25

array with 1 NaNs
q25:  2.0
q50:  3.0
q75:  4.0

array with 2 NaNs
q25:  2.25
q50:  3.5
q75:  nan

}}}

--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1653>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
```