On Thu, Dec 3, 2009 at 10:24 AM, Howard Chong <[email protected]> wrote:

> Thanks for all the help and suggestions. I think the partial sort is
> exactly what I need.
>
> I thought of doing it as a full sort with argsort(), but that would be much
> slower if I just need a small number (maybe 7) from a large array,
> potentially thousands or a million repeated many times.
>
> In case you are wondering, I am doing this to find the 7 nearest neighbors
> in a GIS. For a list of zipcodes in America, find the 7 nearest weather
> stations.
>
>

Have you looked at the kdtree in scipy? It is aimed precisely at this sort
of problem.

<snip>

Chuck
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to