[Numpy-discussion] searchsorted
Charles R Harris
charlesr.harris at gmail.com
Fri Jun 2 23:30:05 EDT 2006
Jonathan,
I had a patch for this that applied to numarray way back when. If folks feel
there is a need, I could probably try to get it running on numpy. Bit of a
learning curve (for me), though.
Chuck
On 6/2/06, Jonathan Taylor <jonathan.taylor at stanford.edu> wrote:
>
> I was wondering if there was an easy way to get searchsorted to be
> "right-continuous" instead of "left-continuous".
>
> By continuity, I am talking about the continuity of the function "count"
> below...
>
> >>> import numpy as N
> >>>
> >>> x = N.arange(20)
> >>> x.searchsorted(9)
> 9
> >>> import numpy as N
> >>>
> >>> x = N.arange(20)
> >>>
> >>> def count(u):
> ... return x.searchsorted(u)
> ...
> >>> count(9)
> 9
> >>> count(9.01)
> 10
> >>>
>
> Thanks,
>
> Jonathan
>
> --
> ------------------------------------------------------------------------
> I'm part of the Team in Training: please support our efforts for the
> Leukemia and Lymphoma Society!
>
> http://www.active.com/donate/tntsvmb/tntsvmbJTaylor
>
> GO TEAM !!!
>
> ------------------------------------------------------------------------
> Jonathan Taylor Tel: 650.723.9230
> Dept. of Statistics Fax: 650.725.8977
> Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo
> 390 Serra Mall
> Stanford, CA 94305
>
>
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060602/85a98a87/attachment-0001.html>
More information about the NumPy-Discussion
mailing list