import numpy as np a = [[1,2],[3,4]] np.mean(a) # (1+2+3+4)/4 = 2.5 np.mean(a, axis=0) # [mean(1,3), mean(2,4)] = [2.0, 3.0] np.mean(a, axis=1) # [mean(1,2), mean(3,4)] = [1.5, 2.5]