faster scipy.percentileofscore ?

Robert Kern robert.kern at
Mon Feb 2 19:28:37 CET 2009

On 2009-02-02 12:08, Vincent Davis wrote:
> Currently I am using the following:
> pgrades = [scipy.percentileofscore(grades,x) for x in grades]
> I need the percentile of each number in grades. The problem is that it
> takes a long time (a few minutes) because there are 15,000 items in
> the list.
> does anyone know is there is a faster way?

from scipy import stats
pgrades = (stats.rankdata(grades)-1) / (len(grades)-1) * 100

You will probably want to ask further scipy questions on the scipy mailing list.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list