← NumPy & Pandas learning pathNumPy & Pandas · Module 1 of 10
NumPy arrays
NumPy gives fast arrays for numerical computing in Python.
📖 Key ideas
- import numpy as np.
- Create arrays: np.array([1, 2, 3]), np.zeros(5), np.arange(0, 10, 2).
- Arrays have shape, dtype and ndim.
- NumPy arrays are much faster than Python lists for maths.
- All elements share one data type.
💡 Real-life example: A NumPy array is a neatly packed egg tray: same-sized slots, quick to count and process.
ndarrayNumPy's N-dimensional array
shapeSize along each dimension
dtypeData type of elements
np.arangeCreates evenly spaced values