Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: John Hunter <jdhunter@ac...>  20030826 15:04:51

>>>>> "Charles" == Charles Twardy <ctwardy@...> writes: Charles> Hey all, I couldn't find any code to do quantiles in Charles> Python. It seems like it belongs in pythonstats, and Charles> maybe other places like MLab or matplotlib. But at least Charles> in pythonstats. Put it there if you think it belongs. Good point. I'm going to follow the matlab signature for matplotlib. The matlab function for this is 'prctile', and takes percents rather than fractions for the percentile. Also it doesn't do interpolation. def prctile(x, p = (0.0, 25.0, 50.0, 75.0, 100.0)): """ Return the percentiles of x. p can either be a sequence of percentil values or a scalar. If p is a sequence the ith element of the return sequence is the p(i)th percentile of x """ x = sort(x) Nx = len(x) if not iterable(p): return x[int(p*Nx/100.0)] p = multiply(array(p), Nx/100.0) ind = p.astype(Int) ind = where(ind>=Nx, Nx1, ind) return take(x, ind) I'll put it in matplotlib.mlab; let me know if you find any problems. JDH 