NumPy
noun
say it: “NUM-pye” /ˈnʌmpaɪ/
A popular Python library for fast math on large lists of numbers, which pandas uses to store and calculate its columns.
What is NumPy?
NumPy is the Python library for fast math on arrays of numbers. pandas is built on it: every column keeps its
values in a NumPy array, and to_numpy() hands that array over.
import numpy as np
prices = np.array([20.0, 35.5, 12.0])
print(prices * 0.9) # [18. 31.95 10.8 ]
print(np.mean(prices)) # 22.5
In a sentence
- “With NumPy, taking 10% off a million prices is one line.”
- “pandas stores each column's numbers in a NumPy array.”
Level: Journeyman · More Python terms at this level
Updated