I have a following dataframe..
coupon_type dish_id dish_name dish_price dish_quantity
0 Rs 20 off 012 Sandwich 65 2
1 Rs 20 off 013 Chicken 125 3
2 Rs 20 off 013 Chicken 125 3
3 Rs 20 off 013 Chicken 125 3
ratings reviews coupon_type user_id order_id meals order_area
4 blah blah blah Rs 20 off 9 9 5 London
4 blah blah blah Rs 20 off 9 9 5 London
3 blah blah blah Rs 20 off 9 9 5 London
4 blah blah blah Rs 20 off 9 9 5 London
I am doing groupby on dish_name column.
df_dish_name = df_final.groupby('dish_name')
Then I am performing some ratio operations on groupby.
Which gives me following pandas series..which I am storing in dish_specific_perf
dish_name
Chicken 45.000000
Sandwich 61.111111
Then I am checking one condition in if loop..
if((dish_specific_perf < 50).any() == True):
If the condition is true then, I want to add ("NP") string to corresponding dish name in dataframe.. So, In dataframe it should look like this.
coupon_type dish_id dish_name dish_price dish_quantity
0 Rs 20 off 012 Sandwich 65 2
1 Rs 20 off 013 Chicken 125 3
2 Rs 20 off 013 Chicken 125 3
3 Rs 20 off 013 Chicken 125 3
ratings reviews coupon_type user_id order_id meals order_area
4 blah blah blah Rs 20 off 9 9 5 London
4 blah blah blah Rs 20 off 9 9 5 London
3 blah blah blah Rs 20 off 9 9 5 London
4 blah blah blah Rs 20 off 9 9 5 London
Flag
Null
NP
NP
NP
The problem with this is how do I compare series elements with dataframe dish_name column to check whether chicken exist or not?
when I do
dish_specific_perf[0]
It just gives me a number as 45.
Please help..