0
0
SciPydata~15 mins

NumPy array foundation review in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
NumPy array foundation review
📖 Scenario: You are working with temperature data collected from sensors in a greenhouse. The data is stored as a list of daily temperature readings. You want to use NumPy arrays to handle this data efficiently.
🎯 Goal: Build a simple program that creates a NumPy array from a list of temperatures, sets a threshold temperature, filters the array to find days warmer than the threshold, and prints those warmer temperatures.
📋 What You'll Learn
Create a NumPy array with exact temperature values
Create a threshold variable with a specific value
Use NumPy array filtering to select temperatures above the threshold
Print the filtered warmer temperatures
💡 Why This Matters
🌍 Real World
Scientists and engineers often use NumPy arrays to efficiently handle and analyze sensor data like temperatures.
💼 Career
Data analysts and data scientists use array filtering to quickly find important data points and make decisions based on thresholds.
Progress0 / 4 steps
1
Create a NumPy array of temperatures
Import the numpy library as np. Then create a NumPy array called temps with these exact temperature values: 22.5, 25.0, 19.8, 23.1, 26.7, 21.0.
SciPy
Need a hint?

Use np.array([...]) to create the array with the exact values.

2
Set a temperature threshold
Create a variable called threshold and set it to the value 23.0.
SciPy
Need a hint?

Just assign the number 23.0 to the variable threshold.

3
Filter temperatures above the threshold
Create a new NumPy array called warm_days that contains only the temperatures from temps that are greater than threshold. Use NumPy array filtering.
SciPy
Need a hint?

Use the condition temps > threshold inside square brackets to filter.

4
Print the warmer temperatures
Print the warm_days array to display the temperatures warmer than the threshold.
SciPy
Need a hint?

Use print(warm_days) to show the filtered temperatures.