If Else Statement Using Apply & Lambda
Python
In this code snippet we use a lambda function to create if else conditional logic and use an apply function to apply this to the orders dataframe.
1| orders['in_promo'] = orders['PromoID'].apply(lambda x: 'N' if x == 'None' else 'Y')
142
127
122
115