numpy var code example Example: numpy get variance of array import numpy as np x = [1,2,3,4,5] variance = np.var(x)