I have two tables with eCommerce site data, one with more categorical data about the stores and another with metrics on each store's performance.
Stores table:
region country_code outlet_id creation_date brand_id
0 EEMEA KZ 231405 2020-10-29 147598
1 EEMEA UA 311975 2021-05-27 216498
2 SWE PL 246038 2020-12-07 117980
3 SWE IT 292770 2021-04-15 288500
4 SWE ES 300967 2021-05-03 298416
Metrics table:
store_id month total_orders delivered_orders bad_rating_orders
0 196105 2020-06 12 11 2
1 196148 2020-06 1 0 0
2 194503 2020-06 14 13 1
3 199178 2020-06 6 6 0
4 194898 2020-06 14 13 0
I need to join the two tables based on the store_id but some of the store_ids correspond to an outlet_id and others to a brand_id.
Is there a way for me to merge/join on store_id with values from outlet_id or brand_id where the store_id matches.
Thanks very much in advance for your help!