I have the following dataframe:
Date Operator 1 Competitor Price Sales
1/1/2021 Store1 Store2 15 100
1/1/2021 Store2 Store1 25 110
2/1/2021 Store1 Store2 15 105
2/1/2021 Store2 Store1 25 103
3/1/2021 Store1 Store2 15 120
3/1/2021 Store2 Store1 25 130
My desired output is to create two new columns, of the competitors price and sales for that day:
Date Operator 1 Competitor Price Sales C.Price C.Sales
1/1/2021 Store1 Store2 15 100 25 110
1/1/2021 Store2 Store1 25 110 25 100
2/1/2021 Store1 Store2 15 105 25 103
2/1/2021 Store2 Store1 25 103 25 105
3/1/2021 Store1 Store2 15 120 25 130
3/1/2021 Store2 Store1 25 130 25 120
How can I lookup the Competitor
within Operator 1
and return those values? I can do it in excel (via VLOOKUP) but not sure in pandas. Thanks very much!