๐ข
STUDENT NOTES ยท DAY 19 OF 24
Math at Lightning Speed โก
A million numbers, one line of maths. NumPy is the muscle behind data science and AI.
1Arrays: lists that know maths
๐
Py: Multiply a normal list by 2 and it DUPLICATES itself. Multiply a NumPy array by 2 and every number doubles. Very different superpowers!
2Instant statistics
๐ค
Bittu: A million exam scores? .mean() answers before your finger leaves the Enter key. NumPy runs on optimized C โ my native language. ๐ค
3Making arrays from thin air
๐ฆ
Professor Hoot: Note the dots in [0. 0. 0.] โ zeros() makes FLOATS by default. And arange works just like range, but array-flavoured.
4shape โ always check the shape
5Quick quiz! ๐ง
np.array([1, 2, 3]) * 2 givesโฆ
๐ก NumPy maths is element-wise: every number gets the treatment. (A plain list would duplicate!)
The universal NumPy import isโฆ
๐ก `as np` โ the most famous nickname in Python. Every tutorial on Earth uses it.
6Your mission ๐
Mission 1: Make an array of your last 5 test scores. Print the mean, max and min.
Mission 2: Add 5 grace marks to ALL scores in one line. NumPy magic!
Mission 3: Create np.arange(1, 11) ** 2 โ the first ten square numbers, one line.
Day 19 done โ lightning mathematician! โก
Next: pandas โ Excel superpowers inside Python.
Go to Day 20: Pandas โ