Using np.where() for Conditional Selection
📖 Scenario: You work in a store that tracks daily sales numbers. You want to quickly find which days had sales above a certain target.
🎯 Goal: Build a small program that uses np.where() to find the days with sales above a target number.
📋 What You'll Learn
Create a numpy array with exact daily sales numbers
Create a variable for the sales target
Use
np.where() to find indices where sales exceed the targetPrint the indices of days with sales above the target
💡 Why This Matters
🌍 Real World
Stores and businesses often need to quickly find days or items that meet certain conditions, like sales targets, to make decisions.
💼 Career
Data analysts and scientists use conditional selection with numpy to filter and analyze data efficiently.
Progress0 / 4 steps