modified line 11 to add 20 to elements > 10
This commit is contained in:
parent
d45a31970f
commit
9f57dddd92
@ -7,8 +7,8 @@ This script demonstrates basic NumPy array manipulation:
|
||||
"""
|
||||
# Product prices
|
||||
prices = np.array([15, 8, 22, 7, 12, 5])
|
||||
# Assign 20 to every price greater than 10
|
||||
prices[prices > 10] = 20
|
||||
# Add 20 to every price greater than 10
|
||||
prices[prices > 10] += 20
|
||||
|
||||
# Product ratings for two categories over three criteria
|
||||
ratings = np.array([[6, 8, 9], [7, 5, 10]])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user