Using np.in1d() for Membership Testing
📖 Scenario: You work in a store that tracks product IDs. You want to check which products from a new shipment are already in your current inventory.
🎯 Goal: Build a small program that uses np.in1d() to find which product IDs from the shipment are already in the inventory.
📋 What You'll Learn
Create two numpy arrays: one for current inventory product IDs and one for new shipment product IDs.
Create a variable to store the membership test result using
np.in1d().Print the boolean array showing which shipment products are in the inventory.
💡 Why This Matters
🌍 Real World
Stores and warehouses often need to check if new products are already in stock to avoid duplicates or manage inventory.
💼 Career
Data analysts and inventory managers use membership testing to clean and filter product data efficiently.
Progress0 / 4 steps