I'm new to pandas and I'm trying to figure this scenario out: I have a sample DataFrame with two products. df =
Product_Num Date Description Price 10 1-1-18 Fruit Snacks 2.9910 1-2-18 Fruit Snacks 2.9910 1-5-18 Fruit Snacks 1.9910 1-8-18 Fruit Snacks 1.9910 1-10-18 Fruit Snacks 2.9945 1-1-18 Apples 2.99 45 1-3-18 Apples 2.9945 1-5-18 Apples 2.9945 1-9-18 Apples 1.4945 1-10-18 Apples 1.4945 1-13-18 Apples 1.4945 1-15-18 Apples 2.99
I also have another small DataFrame that looks like this (which shows promotional prices of the same products): df2=
Product_Num Price 10 1.9945 1.49
Notice that df2 does not contain columns 'Date' nor 'Description.' What I want to do is to remove all promo prices from df1 (for all dates that are on promo), using the data from df1. What is the best way to do this?
So, I want to see this:
Product_Num Date Description Price 10 1-1-18 Fruit Snacks 2.9910 1-2-18 Fruit Snacks 2.9910 1-10-18 Fruit Snacks 2.9945 1-1-18 Apples 2.99 45 1-3-18 Apples 2.9945 1-5-18 Apples 2.9945 1-15-18 Apples 2.99
I was thinking of doing a merge on columns Price and Product_Num, then seeing what I can do from there. But I was getting confused because of the multiple dates.