def constrain(table, column, minval, maxval, shift=0):
    """ Constrains values like so:
        - removes rows with values < minval
        - caps column values at maxval
        - shift values by shift (e.g. to allow for 0 to mean 1 bedroom)
    """
    table = table[table[column] >= minval]
    table.loc[table[column] > maxval, column] = maxval
    table[column] = table[column] + shift
    return table