What is NumPy in Python?
Answer
NumPy is the fundamental package for scientific computing in Python, providing a powerful N-dimensional array object and vectorized mathematical operations. The core is the ndarray — a contiguous block of memory storing homogeneous data. Operations on arrays are vectorized (applied element-wise in C) — 10-100x faster than Python loops. Create: np.array([1, 2, 3]), np.zeros((3, 4)), np.ones(), np.arange(0, 10, 0.5), np.linspace(0, 1, 100). Operations: arr * 2, arr + arr, np.sqrt(arr). Indexing: arr[0, 1], slicing: arr[1:3, :], boolean indexing: arr[arr > 5]. Broadcasting: operations on different-shaped arrays. Reshape: arr.reshape(2, 3). Linear algebra: np.dot(), np.linalg.solve(). NumPy is the foundation of the Python data science stack (Pandas, SciPy, Matplotlib, scikit-learn).