Introduction to NumPy
Get acquainted with NumPy, a Python library used to store arrays of numbers, and learn basic syntax and functionality.
StartKey Concepts
Review core concepts you need to learn to master this subject
Indexing NumPy elements using conditionals
NumPy element-wise logical operations
Creating NumPy Arrays from files
NumPy Arrays
Accessing NumPy Array elements by index
NumPy element-wise arithmetic operations
Indexing NumPy elements using conditionals
Indexing NumPy elements using conditionals
numbers = np.array([-5, 4, 0, 2, 3])
positives = numbers[numbers > 0]
print(positives)
# array([4, 2, 3])
NumPy elements can be indexed using conditionals. The syntax to filter an array using a conditional is array_name[conditional]
.
The returned array will contain only the elements for which the conditional evaluates to True
.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory