def rebase_expr(expr, offset):
    """Subtract the given offset from each column access.

    Assumes that named attribute references have been converted to integer
    positions.
    """
    assert 0 > offset

    for ex in expr.walk():
        assert not isinstance(ex, NamedAttributeRef)
        if isinstance(ex, UnnamedAttributeRef):
            ex.position -= offset
dataset/ETHPy150Open uwescience/raco/raco/expression/util.py/rebase_expr/swapped operands of `>`