Detecting Number Signs Using np.sign()
📖 Scenario: Imagine you have a list of daily temperature changes in degrees Celsius. Some days are warmer (positive change), some are colder (negative change), and some days have no change (zero). You want to quickly find out which days were warmer, colder, or stayed the same.
🎯 Goal: You will create a program that uses np.sign() to detect the sign of each temperature change and output the results as an array of -1, 0, or 1.
📋 What You'll Learn
Create a numpy array with exact temperature changes
Create a variable to hold the numpy array
Use
np.sign() to find the sign of each numberPrint the resulting sign array
💡 Why This Matters
🌍 Real World
Detecting signs of numbers is useful in finance to know if stock prices went up or down, in weather to track temperature changes, or in any data where direction matters.
💼 Career
Data scientists often need to quickly classify data points by their sign to make decisions or prepare data for further analysis.
Progress0 / 4 steps