[Numpy-discussion] quickselect

josef.pktd at gmail.com josef.pktd at gmail.com
Wed May 29 00:12:11 EDT 2013


On Tue, May 28, 2013 at 6:31 PM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
> Hi All,
>
> There is a PR adding quickselect to numpy as a function `partition`.
> Comments on name and exposure in the numpy API are welcome.

I think the name is fine. It's possible to get used to it.

One possible use I can think of is if I want to sort afterwards only
one of the tails (like largest 15%).

Limitations:

medium: like percentiles it would be nice to partition into more than
two sets, if that can be done more efficiently than calling the
function twice.

major:
it won't work to calculate the median or other quantiles since those interpolate
np.median: "When N is even, it is the average of the two middle values
of V_sorted"

AFAICS based on the docstring (I closed my eyes when the c code scrolled by)

Josef

>
> Chuck
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list