If you want the same idea in a DataFrame API, read pandas merge inner next. If you want the plain Python index-building mechanic first, read inner join by key.
An inner equi-join matches rows by key under SQL bag semantics: duplicate matches fan out and nonmatching keys disappear.
highlighted = computed this step
Orders input
Start with order rows. Two orders share the same customer key; one order has no matching customer.
Orders
Customers input
Customers is also a bag: one key appears twice, so each matching order pairs with both rows.
Customers
Inner join
INNER JOIN keeps only TRUE key matches: Orders.customer_id = Customers.customer_id.
Orders⋈customer_idCustomers
Joined output
The result has four rows: two matching orders times two customer rows; the unmatched order is dropped.