TodayTools

NumPy flashcards

Fast maths on whole grids of numbers in Python: the engine under pandas, images and machine learning.

Donate
Beginner friendly, starts from zero
Section
How to study
0
NumPyStart from zero · 1 of 11

What is NumPy, in one plain sentence?

NumPy is a free Python library for doing maths on many numbers at once, stored in a grid called an .

Num + Py: numbers in Python.
Show again
11 left
Got it

Tap to turn over. Swipe right if you know it, left to see it again.

All topics

What you will learn

  1. Start from zero

    • What NumPy is and why4 cards
    • The key words4 cards
    • Getting started3 cards
  2. Core basics

    • Making arrays4 cards
    • Indexing and slicing4 cards
    • Maths without loops5 cards
    • Joining, sorting and counting3 cards
  3. Next steps

    • Broadcasting3 cards
    • Indexing like a pro3 cards
    • Matrices and linear algebra3 cards
    • Statistics and float care4 cards
    • Saving and dates3 cards
  4. Go deeper

    • Memory and layout4 cards
    • Dtypes and NumPy 2 rules5 cards
    • Advanced operations4 cards
    • Speed and the wider world4 cards

Final test and certificate

10 questions drawn fresh from the whole topic, about 15 minutes. Sign in, score 80% or more and get a free certificate with your name and a public check link anyone can open, such as an employer or a teacher. Not signed in? Try a practice test from the cards.

Take the final test

About these cards

  • Reviewed 26 October 2026
  • CoversNumPy 2.5Python 3.12+
How these cards are made

NumPy at a glance

NumPy is a Python library that does maths on thousands or millions of numbers at once, very fast.

A NumPy array is like an egg tray: every slot is the same size and holds the same kind of thing, so you can work on the whole tray in one go.

Words you will meet

Array
A grid of numbers that all have the same kind, stored together
Element
One number inside an array
Dimension
A direction in the grid: a list has 1, a table has 2
Shape
How many elements the array has along each dimension, like (3, 4)
Axis
The number of one dimension: axis 0 runs down rows, axis 1 runs across columns
dtype
The kind of number each element is, like whole number or decimal
Vectorised
One command that works on every element at once, with no loop

The steps

  1. 1. Start from zero (11 cards): What NumPy is, why it is fast, and the words every later card uses.
  2. 2. Core basics (16 cards): Create arrays, read their shape, slice them, and do maths and statistics without loops.
  3. 3. Next steps (16 cards): Broadcasting, views, linear algebra and float care: NumPy used every week in real work.
  4. 4. Go deeper (17 cards): Memory layout, dtype rules, NumPy 2 changes and performance: what a senior engineer knows.
All 11 cards in Start from zero
What is NumPy, in one plain sentence?
NumPy is a free Python library for doing maths on many numbers at once, stored in a grid called an array.
Why not just use a normal Python list of numbers?
A list can hold anything, so Python checks each item one by one. A NumPy array holds one kind of number packed tightly, so maths runs in fast compiled code, often 50 to 100 times faster.
Where do you meet NumPy without seeing it?
Every pandas column, every photo filter in Python, every weather or finance model, and most machine learning code use NumPy arrays underneath.
What everyday thing is a NumPy array like?
An egg tray. Every slot is the same size and holds the same thing, and you can carry or wash the whole tray at once instead of one egg at a time.
What are an array, an element and a dimension?
An array is the whole grid. An element is one number in it. A dimension is a direction: a row of numbers has 1 dimension, a table has 2, a colour photo has 3.
What do shape and axis mean?
Shape counts elements along each dimension: a table of 3 rows and 4 columns has shape (3, 4). Axis 0 is the row direction (down), axis 1 is the column direction (across).
What is a dtype?
The kind of number every element is: whole numbers like int64, decimals like float64, or true/false bool. One array has one dtype.
What does vectorised mean?
Writing one command that works on every element at once, like prices * 1.18, instead of a loop that visits each number.
What do you need before starting NumPy?
Python basics (lists, loops, functions) and NumPy installed with pip install numpy. School maths like averages is enough; matrices come later.
What does this first NumPy program do?
It imports NumPy as np, makes an array of three prices, and adds 18 percent tax to all of them in one line.
What will you be able to do after this topic?
Build and slice arrays, do maths and statistics on them, use masks and broadcasting, and avoid the memory and dtype bugs that trip up working engineers.
NumPy cheatsheet

Create

  • np.array(list, dtype=) From a list
  • np.zeros(shape) / np.ones(shape) Filled array
  • np.arange(start, stop, step) Stepped integers
  • np.linspace(a, b, n) n points from a to b
  • np.random.default_rng(seed) Reproducible random
  • a.reshape(-1, 4) New shape, -1 inferred

Select

  • a[r, c] / a[:, -1] Cell / last column
  • a[a > 0] Boolean mask, copy
  • a[[0, 2, 5]] Fancy index, copy
  • a[1:5] Slice, view
  • a[:, None] Add an axis
  • np.where(c, x, y) Pick element-wise

Compute

  • a.sum(axis=0, keepdims=True) Reduce, keep shape
  • np.nanmean(a) Mean ignoring NaN
  • np.percentile(a, 90) 90th percentile
  • a @ b Matrix product
  • np.linalg.solve(A, b) Solve Ax = b
  • np.cumsum / np.diff Running total / change

Care and speed

  • np.isclose / np.allclose Float compare
  • np.shares_memory(a, b) View check
  • np.multiply(a, b, out=buf) No temporary
  • np.add.at(a, idx, 1) Repeated indices
  • np.load(p, mmap_mode="r") Bigger than memory
  • a.astype(np.float32) Change dtype (copy)
Donate