The array that numerical Python is built on: shape and reshaping, indexing and slicing, element-wise operations, aggregating along an axis, and broadcasting.
No account needed to read a lesson · 30-day money-back guarantee
See the full learning path8
lessons
66
practice questions
83
prerequisite lessons
1 of the 8 lessons here is free to preview - the whole explanation and worked example, with no account and no email.
The editor you get
A still of the editor, not a live one
Python Editor
Editor Output
Output:
[2 4 6] 2.0
You write and run Python in the browser - nothing to install, no setup. Questions are marked on the values your code produces. The snippet here is an example of the kind of code you write.
The 8 lessons in this unit. Expand any one to see what it covers. Each unlocks when its own prerequisites are passed.
01
Introduction to NumPy
10 questions
Understand what NumPy arrays are, why they are used for efficient numerical computation, and how to create 1D and 2D arrays in Python using NumPy functions.
Covers
Introduction to NumPy
What is a NumPy array?
Creating 1D - arrays
Creating 2D - arrays
02
NumPy array attributes & inspection
6 questions
Understand how NumPy arrays strictly store data of a single, fixed data type for efficiency, and learn to inspect an array’s type, shape, number of dimensions, and total size using key array attributes.
Covers
NumPy data types
shape, size, and ndim
03
Reshaping & manipulating NumPy arrays
7 questions
Learn how to change the shape of NumPy arrays using .reshape(), ensuring the total number of elements stays the same, and use -1 to let NumPy automatically infer one dimension when reshaping or flattening arrays.
Covers
Reshaping arrays with .reshape()
Using -1 in .reshape() for dimension inference
04
Indexing & slicing NumPy arrays
9 questions
Learn how to index and slice NumPy arrays to access individual elements, rows, columns, and subarrays across any number of dimensions, understanding the roles of integers and colons as indices.
Covers
1D array indexing and slicing
Integer indexing in 2D arrays
The colon : in array indexing
05
Element-wise operations & universal functions
9 questions
Learn how NumPy applies arithmetic and comparison operations element-wise to arrays, how universal functions (ufuncs) perform fast vectorised operations on arrays of any shape, and how boolean arrays result from element-wise comparisons.
Covers
Basic arithmetic between arrays and scalars
Universal functions (ufuncs)
Comparison operators and boolean arrays
06
Array operations: aggregations & axis
9 questions
Learn how to use NumPy aggregation functions to summarise whole arrays or reduce them along one or more axes, allowing flexible calculation of sums, means and other statistics across specific array dimensions.
Covers
Whole‑array aggregations
Aggregations along an axis
Multiple‑axis reductions
07
Selecting NumPy array elements by conditions
6 questions
Learn how to select elements from a NumPy array that meet specified conditions by creating and applying boolean masks, including combining multiple conditions using bitwise operators for complex filtering.
Covers
Boolean masks from conditions
Combining multiple conditions
08
Broadcasting NumPy arrays
10 questions
Learn how NumPy broadcasting enables element-wise operations between arrays of different shapes, understand the rules that determine when broadcasting is possible, and see how techniques like using keepdims=True during reduction operations ensure broadcast compatibility.
Covers
What is broadcasting?
Rules of broadcasting
Applying broadcasting in practice
Using keepdims when broadcasting
This unit is part of our Essential Python for Data Science and ML learning path, which contains 117 lessons. Every one of them is drawn below.
The diagnostic test lets you skip any lesson you already know, including the ones in this unit.
Hover any dot to name its lesson.
8 lessons in this unit
83 prerequisite lessons across the unit, counting every step back to the start
26 other lessons in the learning path - after this unit, or alongside it
Builds on: Assorted extras, Sequences
Leads to: Pandas
One subscription covers every learning path, and you can test out of anything you already know.
One subscription covers every learning path · 30-day money-back guarantee
More in Libraries for data science and machine learning: Pandas