Using .apply on a dataframe with two columns as input

September 01, 2022


df['col_3'] = df.apply(lambda x: get_sublist(x.col_1, x.col_2), axis=1)


Or if there are spaces in column names

df['col_3'] = df.apply(lambda x: f(x['col 1'], x['col 2']), axis=1)