Data Tools · Module 1
NumPy
Take each lesson, answer its quiz, then do its practice. After the last lesson come the module quiz, the project and the interview questions.
Lessons
- 1.1Why NumPySay what an array holds that a list does not, and why that makes it faster and smaller.
- 1.2Shape, dtype and ReshapingRead any array's shape and dtype, and reshape without copying.
- 1.3Indexing, Slicing and MasksSelect exactly the elements you want, including by condition.
- 1.4Vectorised Operations and BroadcastingCompute on whole arrays at once, and predict when shapes combine.
- 1.5Aggregations Along AxesSum, average and find extremes over rows or columns.
- 1.6Linear Algebra in NumPyWrite the maths of the ML videos directly as code.
- 1.7Random Numbers and ReproducibilityGenerate random data you can reproduce.
Module material
Take these after the last lesson, in this order. Next on each page leads through them.
- Module quiz15 questions across the whole module. Take it after the last lesson; your first pick on each question is the one that counts.
- Project: The chain's year, in NumPyStated as a problem, with no template and no step-by-step instructions. Working out the steps is the point.
- NotebooksOpen them in Google Colab. Each answer is checked as you go: correct, wrong with the expected value, or not answered yet.
- Common mistakesWhat you see when it goes wrong, why it happens, and the fix, across the whole module.
- Cheat sheetOne page of the module’s terms, rules and gotchas, with the output each rule produces.
- Interview questions22 questions interviewers ask on numpy, from first principles to the follow-ups. The first 3 model answers are free to read; Pro opens the rest.
Glossary
Every term the module introduces, with the lesson that introduces it.
- Array
- Values in a typed buffer, interpreted through a shape 1.1
- Buffer
- Contiguous storage for the array's elements 1.1
- Object dtype
- References to Python objects instead of fixed-width numeric values 1.1
- Shape
- Element count on each axis, as a tuple 1.2
- Dimension /
ndim - An axis / the number of axes 1.2
dtype- The type and width used for array elements 1.2
- Reshape
- Interpret the same number of elements with a new shape; a copy is possible for non-contiguous inputs 1.2
- View
- An array sharing data with another array 1.3
- Copy
- An array with independent data 1.3
- Slice
- Position range with excluded stop; basic slicing generally returns a view 1.3
- Boolean mask
- Boolean array selecting elements where it is true 1.3
- Fancy indexing
- Selection by integer positions; returns a copy 1.3
- Vectorisation
- Applying an operation to an entire array instead of a Python loop over its elements 1.4
- Universal function
- NumPy function applying an operation elementwise 1.4
- Broadcasting
- Matching dimensions from the right, repeating a size-one dimension conceptually 1.4
- Axis
- Dimension named by an operation; reduction removes that dimension 1.5
- Reduction
- Combining values along an axis, such as
sumormean1.5 keepdims- Retain a reduced axis with size one 1.5
argmax- Position of the maximum, not the maximum value 1.5
- Transpose
- Exchange axes of a two-dimensional array 1.6
- Matrix product
- Row-column combination written
@1.6 - Linear system
- Equations represented as
A @ w = b1.6 - Generator
- Object with its own random state and sampling methods 1.7
- Seed
- Starting value used to reproduce a generator's sequence 1.7
- Permutation
- Reordering of positions without duplication 1.7