Handwritten Style NumPy Notes
Handwritten Style NumPy Notes
Introduction to NumPy
NumPy Arrays
Examples:
>>> import numpy as np
>>> a = np.array([1, 2, 3])
>>> a.shape -> (3,)
>>> a.dtype -> int64
Array Creation
Array Operations
- Element-wise operations:
a + b, a - b, a * b, a / b
- Matrix multiplication: np.dot(a, b) or a @ b
- Useful functions: np.sum, np.mean, np.std, np.max, np.min
Handwritten-style Notes: NumPy for Data Science & ML
Broadcasting
Example:
>>> a = np.array([[1,2,3],[4,5,6]])
>>> b = np.array([1,0,1])
>>> a + b -> [[2 2 4], [5 5 7]]
Random Module
Useful Tips