def apercentileofscore (inarray,score,histbins=10,defaultlimits=None):
    h, lrl, binsize, extras = histogram(inarray,histbins,defaultlimits)
    cumhist = cumsum(h*1)
    i = int((score - lrl)/float(binsize))
    pct = (cumhist[i-1]+((score-(lrl+binsize*i))/float(binsize))*h[i])/float(len(inarray)) * 100
    return pct
Note: result of this function depends on the values used to histogram
dataset/ETHPy150Open radlab/sparrow/src/main/python/third_party/stats.py/apercentileofscore