def f(s):
if s['col1'] == 2:
return s['new_column'] = s['col1']
elif s['col2'] == 3:
return s['new_column'] = s['col2']
else:
return s['new_column'] = s['col3']
This did not worked, I know np.select but I have different nested ifs and I must create a column with so many conditions. How can I do it?