New to Python, working with dataframes.
I have a df like this:
| Company | Year | Week |
|---|---|---|
| Retailer | 2020 | 1 |
| Retailer | 2020 | 2 |
| Wholesale | 2021 | 1 |
And a df like this: | Company | Year| Week| |:---- |:------:| -----:| | Retailer | 2020 | 1| | Wholesale| 2021 | 1|
And I want this:
| Company | Year | Week | Promo? |
|---|---|---|---|
| Retailer | 2020 | 1 | True |
| Retailer | 2020 | 2 | False |
| Wholesale | 2021 | 1 | True |
Obviously with a lot more variables and rows, but these are the ones I want a match on.
In Excel I would have the two worksheets, and in each make a new columns that combines the columns I want to look up and then use Vlookup on those columns.
I feel there must be an easier, faster and more Python-y way.