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), 0) 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 select(condlist, choicelist, default=0): '''Return dataset with items drawn from choices according to conditions''' return _dsutils.select(condlist, choicelist, default)