[SciPy-dev] percentileofscore in svn

Nathan Bell wnbell@gmail....
Sat Nov 22 13:50:16 CST 2008


On Sat, Nov 22, 2008 at 12:32 PM,  <josef.pktd@gmail.com> wrote:
>
> evaluate for several scores at the same time:
> a = [1,2,3,4,5,6,7,8,9,10]
> percentileofscore(a,[4,5,8])
> or
> percentileofscore(a,np.array([4,5,8]))
> instead of
> for s in [4,5,8]:
>    percentileofscore(a,s)
>
> For example if "a" are the student grades, then
> percentileofscore(a,a)
> would give you the ranking of every student.
>
> percentileofscore(a,[4,5,8], kind = 'weak') would provide empirical
> cumulative frequency for 4,5,8
>
> But I didn't see a way of gaining much in the function compared to the
> simple for loop.
>

Hi Josef,

Is there a reason why you couldn't implement percentileofscore() with
numpy's searchsorted()?  That would give you vectorization and more
efficiently handle large #s of bins.


-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Scipy-dev mailing list