An orders table refers to customers by id, and the customer names live in a second table. You want every order with its customer's name next to it, and a clear mark on the orders whose customer id is not in the customer table.
Write join_orders_to_customers(orders, customers).
orders has the columns order_id, customer_id and amount.customers has the columns customer_id and name. A name is never missing.Left join orders to customers on customer_id, so that every order is kept. Return a new DataFrame with the columns order_id, customer_id, amount, name, matched, in that order:
name is the customer's name, or missing (NaN) when the order's customer_id does not appear in customers;matched is True when the order found a customer and False when it did not.The rows follow the order of orders.
customer_id appears more than once in customers, the order appears once for each of those customer rows, in the order they have in customers. That is what a join does, and you should not remove these rows._merge column or any other extra column.orders or customers. The index of the result does not matter.