[Scipy-tickets] [SciPy] #1634: scoreateprecentile return the worng value when used on pandas.Series

SciPy Trac scipy-tickets@scipy....
Tue Mar 27 08:52:00 CDT 2012


#1634: scoreateprecentile return the worng value when used on pandas.Series
----------------------------------------+-----------------------------------
 Reporter:  imrisofer                   |       Owner:  somebody   
     Type:  defect                      |      Status:  new        
 Priority:  normal                      |   Milestone:  Unscheduled
Component:  scipy.stats                 |     Version:  0.10.0     
 Keywords:  scoreateprecentile, pandas  |  
----------------------------------------+-----------------------------------
 scoreatprecentile of a pandas.Series returns the wrong value


 {{{
 import pandas as pd
 In [1341]: a = np.random.rand(100)

 In [1342]: b = pd.Series(a)

 In [1343]: a[:10]

 Out[1343]:
 array([ 0.6131142 ,  0.65266141,  0.24583156,  0.70179786,  0.33361506,
         0.65042728,  0.70192276,  0.02727854,  0.65948894,  0.44326182])

 In [1348]: scoreatpercentile(a,1)
 Out[1348]: 0.010388922650144839 #correct value

 In [1349]: scoreatpercentile(b,1)
 Out[1349]: 0.65226593993834392 #incorrect value

 In [1350]: scoreatpercentile(a,2)
 Out[1350]: 0.011971896338709577 #correct value

 In [1351]: scoreatpercentile(b,2)
 Out[1351]: 0.25396815348880808 #incorrect value


 }}}


 this can be solved by calling np.asarray on the input.
 you can see more on this issue here:
 https://github.com/pydata/pandas/issues/972#issuecomment-4716127

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


More information about the Scipy-tickets mailing list