Join log to customers (left join on Customer ID = customer_id) and find orders whose customer is not in the customer master (ignore the TEST row).
Store those orders' Order ID values as a list in result.
import pandas as pd
log = pd.DataFrame({
"Order ID": [9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9010],
"Customer ID ": ["C1", "C2", "C1", "TEST", "C3", "C2", "C4", "C1", "C5", "C3"],
"Order Time": ["2025-05-03 09:15", "2025-05-03 13:40", "2025-05-04 20:05", "2025-05-04 11:00", "2025-05-05 09:50",
"2025-05-06 21:30", "2025-05-06 13:10", "2025-05-07 20:45", "2025-05-08 09:05", "2025-05-08 13:55"],
"City": ["Pune", "Delhi", "Pune", "Pune", "Mumbai", "Delhi", "Jaipur", "Pune", "Mumbai", "Mumbai"],
"Items": ["Shirt|Jeans", "Saree", "Shirt", "Shirt", "Kurta|Shirt|Jeans", "Jeans", "Saree|Kurta", "Jeans", "Shirt", "Kurta"],
"Amount (Rs)": [1899, 2499, 799, 1, 3297, 1099, 3599, 1099, 799, 1299],
"Status": ["D", "D", "C", "D", "D", "R", "D", "D", "C", "D"],
})
customers = pd.DataFrame({
"customer_id": ["C1", "C2", "C3", "C4"],
"name": ["Asha", "Ravi", "Kiran", "Meena"],
"segment": ["Regular", "New", "Regular", "New"],
})Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.