Question
I am having trouble figuring out how to create new DataFrame column based on the values in two other columns. I need to use if/elif/else l
I tried the following and the result was much faster. Hope it's helpful for others.
df['combo'] = 'other' df.loc[df['mobile'] == 'mobile', 'combo'] = 'mobile' df.loc[df['tablet'] == 'tablet', 'combo'] = 'tablet'