I have a data frame for which I would like to add a column value using an if statement. I have been trying a lambda function but have not had luck. I want to add a column that says if threshold< order, then set new column to threshold else set column to order.
df_new
Order Threshold
20,000 100,000
500,000 50,000
100,000 75,000
I tried:
df_new['New Column'].apply(lambda x: df_new['Threshold'] if < df_new['Order'] else df_new['Order Quantity'])
Aucun commentaire:
Enregistrer un commentaire