Topics in this subject
16 topics
NumPy
1. Introduction & Why NumPy
NumPy (Numerical Python) is the foundation of the entire Python scientific stack. Pandas, scikit-learn, TensorFlow, SciPy, and Matplotlib all sit on t
✓2. Creating Arrays
The functions below are the workhorses for constructing arrays. Master these; they appear constantly.
✓3. Array Attributes
Every attribute below is a cheap header read — no computation over the data.
✓4. Data Types (dtypes)
NumPy dtypes control memory and precision.
✓5. Indexing & Slicing
a = np.arange(10) # [0 1 2 3 4 5 6 7 8 9]
✓6. Reshaping
a = np.arange(12)
✓7. Broadcasting
Broadcasting lets NumPy operate on arrays of different shapes without copying data, by virtually stretching smaller arrays.
✓8. Mathematical Operations
a = np.array([1, 2, 3]); b = np.array([4, 5, 6])
✓9. Aggregations
axis=0 collapses rows (result has one value per column). axis=1 collapses columns (one value per row).
✓10. Sorting & Searching
a = np.array([3, 1, 2])
✓11. Combining & Splitting Arrays
a = np.array([[1, 2], [3, 4]])
✓12. Linear Algebra
A = np.array([[1, 2], [3, 4]])
✓13. Random Module
Modern NumPy uses the Generator API (np.random.defaultrng), which is preferred over legacy np.random..
✓14. Performance Optimization
result = np.empty(len(a))
✓15. NumPy Interview Questions (40+)
1. Why is NumPy faster than Python lists?
✓NumPy Exercises
N1. Create a 3×3 array of numbers 1–9.
No topics match that search.