avg of numpy.ndarray code example Example: numpy average import numpy as np a = np.arange(6).reshape(3,2) average = np.average(a)