@jit
def _in_range(x, lo, hi, result):
NAN = float('nan')
for i in range(len(x)):
x_i = x[i]
if is_eq_nan(x_i): result[i] = NAN
...
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAAy-kd%3DTvc1pmBUMsuTOhfup9croM4241t6O7b6GXee-WLivDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
def np_in_range_exclusive(x, lo, hi):
# (x>=lo) & (x<hi)
result = (x>=lo) & (x<hi)
if not may_have_nans(x): return result
else: return np.where(np.isnan(x), NAN, result)
(x>=lo) & (x<hi)
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAOo6sOPBKCK%3DkzA0GHz8EysNqZKmPfbyt%3DySCyMB3a63oF5eBg%40mail.gmail.com.
Well... if can, but:def np_in_range_exclusive(x, lo, hi):
# (x>=lo) & (x<hi)
result = (x>=lo) & (x<hi)
if not may_have_nans(x): return result
else: return np.where(np.isnan(x), NAN, result)although I count 5 new arrays being constructed, when only one is required, AND numpy generates warning for(x>=lo) & (x<hi)where x has nulls
On Thu, Apr 26, 2018 at 3:18 PM, Jason Sachs <jms...@gmail.com> wrote:
On Thu, Apr 26, 2018 at 3:11 PM, Stuart Reynolds <stu...@stuartreynolds.net> wrote:
Is there an (efficient) way to test if an array element is NAN in numba? For example, I'd like to check if x[i] is between lo and hi, or result[i] to NAN is x[i] is NAN"@jit
def _in_range(x, lo, hi, result):
NAN = float('nan')
for i in range(len(x)):
x_i = x[i]
if is_eq_nan(x_i): result[i] = NAN
...
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAAy-kd%3DTvc1pmBUMsuTOhfup9croM4241t6O7b6GXee-WLivDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAOo6sOPBKCK%3DkzA0GHz8EysNqZKmPfbyt%3DySCyMB3a63oF5eBg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAAy-kdnzwr4j6HK906YHOoR%2BDLnKLF%3DiUMPhCOfHoThXf5xbMg%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAAy-kd%3DTvc1pmBUMsuTOhfup9croM4241t6O7b6GXee-WLivDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAOo6sOPBKCK%3DkzA0GHz8EysNqZKmPfbyt%3DySCyMB3a63oF5eBg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAAy-kdnzwr4j6HK906YHOoR%2BDLnKLF%3DiUMPhCOfHoThXf5xbMg%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users+unsubscribe@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/CAE8Ss2GOCaH-x%3D23pF_ecOewsVbTV3w%3Dj9mfQ3piy%3D6AAbJgeA%40mail.gmail.com.