Ravindra BagaleCourses & study guides मराठी Track your progress

28. How to Merge and Join Tables in pandas for Blinkit Data

28.1 Why Join Blinkit-Style Tables

Why. Orders know store_id. City manager name lives on the stores table. Rider phone lives on riders. One mega CSV every morning breaks when a store manager changes. Joins keep grain honest.

What.

  • Fact-like table — orders (many rows, events).
  • Dimension-like table — stores, riders, SKUs (one row per entity).
  • merge — bring columns from B onto A using keys (Excel XLOOKUP / Power BI relationship cousin — Chapter 8 map).

How.

Before you merge

  1. Name the grain of each table (“one row = one order”).
  2. Name the key (store_id, rider_id).
  3. Check uniqueness of the dimension key.
  4. Choose how (usually left from orders).
  5. Compare len before and after.

Worked example A — Tables you will use.

Table Grain Key
orders one order order_id (+ store_id, rider_id)
stores one dark store store_id
riders one rider rider_id

Worked example B — Business question.

“Delivered GMV by store manager for Pune” needs orders ⨝ stores, then filter city, then groupby manager.

Worked example C — Chapter map.

Chapter 8 = first merge. Chapter 23 = explosion warning. This chapter = Blinkit ops patterns + validation.

Ravindra Bagale's Tip

Fact + dimension. Key clean. Length check. Mag groupby.