def update_column(func, columns, dataframe):
    """Apply function to columns in a dataframe

    Args:
      func: the function to apply
      columns: the columns to apply the function
      dataframe: the dataframe to change

    Returns:
      a new dataframe with updated columns

    >>> update_column(
    ...     lambda x: x + 1,
    ...     columns=('x',),
    ...     dataframe=pandas.DataFrame(dict(x=[1, 2], y=[1, 2]))
    ... )
       x  y
    0  2  1
    1  3  2

    """
    return dataframe.apply(lambda x: func(x) if x.name in columns else x)