(a, b, condition)
return arr
Inverse of `split_on_condition`.
Inverse of `split_on_condition`.
Inverse of split_on_condition .
def stack_on_condition(a, b, condition):
    """
    Inverse of `split_on_condition`.
    """
    axis = 0
    N = condition.size
    shape = list(a.shape)
    shape[axis] = N
    shape = tuple(shape)
    arr = np.empty(shape, dtype=a.dtype)
    arr[condition] = a
    arr[~condition] = b
    return arr
def stack_on_condition ( a , b , condition ) : axis = 0 N = condition . size shape = list ( a . shape ) shape [ axis ] = N shape = tuple ( shape ) arr = np . empty ( shape , dtype = a . dtype ) arr [ condition ] = a arr [ ~ condition ] = b return arr