I need a for loop on a column specific. With this for loop, I will assign the value ‘Normal’ to a list if the column contains ‘Themes’. But I don’t know how to write it here. I would be glad if you help. Thanks in advance :) Dataset
Advertisement
Answer
You can use np.where
which is basically an if-else
statement:
df['group'] = np.where(df['Developer ID'].str.contains('Themes'), 'Normal', 'Premium')