def notnull(input): """ Replacement for numpy.isfinite / -numpy.isnan which is suitable for use on object arrays. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean """ if isinstance(input, np.ndarray): return -isnull(input) else: return not tseries.checknull(input)
def notnull(input): ''' Replacement for numpy.isfinite / -numpy.isnan which is suitable for use on object arrays. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean ''' if isinstance(input, np.ndarray): return -isnull(input) else: return not tseries.checknull(input)
def isnull(input): """ Replacement for numpy.isnan / -numpy.isfinite which is suitable for use on object arrays. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean """ if isinstance(input, np.ndarray): if input.dtype.kind in ("O", "S"): # Working around NumPy ticket 1542 result = input.copy().astype(bool) result[:] = tseries.isnullobj(input) else: result = -np.isfinite(input) else: result = tseries.checknull(input) return result
def isnull(input): ''' Replacement for numpy.isnan / -numpy.isfinite which is suitable for use on object arrays. Parameters ---------- arr: ndarray or object value Returns ------- boolean ndarray or boolean ''' if isinstance(input, np.ndarray): if input.dtype.kind in ('O', 'S'): # Working around NumPy ticket 1542 result = input.copy().astype(bool) result[:] = tseries.isnullobj(input) else: result = -np.isfinite(input) else: result = tseries.checknull(input) return result