Stage 1 · Lesson 2 of 7
NumPy arrays and vectorised maths
is the Python library for : blocks of values of one type that you do maths on all at once. prices * 1.18 multiplies every element without a loop, which is called vectorisation and runs many times faster than a Python for loop.
Every column is a NumPy array underneath, so its rules explain later surprises: an array has one dtype (data type), missing values are (not a number) and shapes must line up when you combine arrays, which NumPy calls .
Learn creating arrays, indexing and slicing, boolean masks, and summary functions such as mean, sum and std.
Common trapthat NumPy's std divides by n by default, while pandas and most statistics divide by n minus 1, so the same data gives two different answers.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
Solid Python basics first: data types, collections, functions and files, the ground pandas stands on
- CourseFreeKaggle Learn
Kaggle · Beginner
Free: the Python and Pandas courses, short lessons with exercises that run in the browser