From: Jonathan T. <jon...@st...> - 2006-06-02 18:08:08
|
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 |