Np.mean() versus np.average() in Python NumPy?

563    Asked by AlexanderCoxon in Python , Asked on Mar 1, 2021
Answered by Alexander Coxon

In certain versions of NumPy there is another significant contrast that you should know:

normal doesn't consider masks, so register the normal over the entire arrangement of data.

mean considers account masks, so register the mean just unmasked qualities.

g = [1,2,3,55,66,77]

f = np.ma.masked_greater(g,5)

np.average(f)

Out: 34.0

np.mean(f)

Out: 2.0



Your Answer

Interviews

Parent Categories