r_c = 'newyork sanfrancisco losangeles'.split()
def my_is_r_c(c):
return c.replace(' ', '').lower() in r_c
train['is_r_c'] = train['c_o'].apply(lambda x: 1 if my_is_r_c(x) else 0)
train['is_r_c'] = train['c_d'].apply(lambda x: 1 if my_is_r_c(x) else 0)
Hi guys
Is there a way to apply the lambda for both columns ['c_o'] and ['c_d'], in only one line?
thx in advance