def where(condition, x=None, y=None): '''Return items from x or y depending on condition''' if x and y: return _dsutils.select(condition, x, y) elif not x and not y: return _cmps.nonZero(condition) else: raise ValueError, "Both x and y must be specified"
def where(condition, x=None, y=None): '''Return items from x or y depending on condition''' if x and y: return _dsutils.select(condition, x, y) elif not x and not y: return _cmps.nonZero(condition) else: raise ValueError, "Both x and y must be specified"
def nonzero(a): '''Return the indices for items that are non-zero''' return _cmps.nonZero(a)
def nonzero(a): '''Return the indices for items that are non-zero''' return _cmps.nonZero(a)