Back to Course
Data Intelligence: NumPy & Pandas
Module 4 of 15
4. Tensors & Manipulation
1. Reshaping Reality
Changing the dimensions without copying data.
pythona = np.arange(9) m = a.reshape(3, 3) # Becomes a matrix
2. Masking (Boolean Indexing)
Forget if statements inside loops. Use Masks.
pythondata = np.array([10, 20, 30, 40]) mask = data > 25 print(mask) # [False, False, True, True] print(data[mask]) # [30, 40]