import numpy as np
values = np.array([1, 2, 3, 4, 5])
valuesarray([1, 2, 3, 4, 5])
Lists are useful, but quantitative work usually needs fast operations over many numbers. NumPy arrays make those operations concise and efficient.
When you multiply an array by 2, NumPy multiplies every element.
This is different from a Python list:
(np.float64(3.0), np.int64(1), np.int64(5), np.int64(15))
The package includes a reusable summary helper.
[1, 2, 3] * 2 repeats a list. np.array([1, 2, 3]) * 2 doubles each value.
Array shape tells you the dimensions of the data. Many numerical errors come from using arrays with incompatible shapes.
[10, 20, 30].10.array_summary(...) on the array.Answer: 20.0.
The mean is (10 + 20 + 30) / 3 = 20.