np.average takes an optional weight parameter. If it is not supplied they are equivalent. Take a look at the source code: Mean, Average

np.mean:

try:
    mean = a.mean
except AttributeError:
    return _wrapit(a, 'mean', axis, dtype, out)
return mean(axis, dtype, out)

np.average:

...
if weights is None :
    avg = a.mean(axis)
    scl = avg.dtype.type(a.size/avg.size)
else:
    #code that does weighted mean here

if returned: #returned is another optional argument
    scl = np.multiply(avg, 0) + scl
    return avg, scl
else:
    return avg
...
Answer from Hammer on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-is-np-mean-different-from-np-average-in-numpy
How is np.mean() different from np.average() in NumPy? - GeeksforGeeks
July 23, 2025 - This code calculates the mean and weighted average of a NumPy array. The mean is the average of the array's elements, and the weighted average considers assigned weights for each element in the array. Python3 ·
🌐
Scaler
scaler.com › home › topics › what is the difference between np.mean() vs np.average()?
What is the difference between np.mean() vs np.average()? | Scaler Topics
May 4, 2023 - The np.mean() method returns the arithmetic mean, but the np.average() function returns the algebraic mean if no additional parameters are specified, but it may also be used to compute a weighted average. I assume it's a fairly straightforward response. Let us delve into the intricacies of ...
Top answer
1 of 1
13

Short Answer:

'Mean' and 'Average' are two different things. People use them interchangeably but shouldn't. np.mean() gives you the arithmetic mean where as np.average() allows you to get the arithmetic mean if you don't add other parameters, but can also be used to take a weighted average.

Long Answer and Background:

Statistics:

Since NumPy is mostly used for working with data sets it is important to understand the mathematical concept that causes this confusion. In simple mathematics and every day life we use the word Average and Mean as interchangeable words when this is not the case.

  • Mean: Commonly refers to the 'Arithmetic Mean' or the sum of a collection of numbers divided by the number of numbers in the collection1
  • Average: Average can refer to many different calculations, of which the 'Arithmetic Mean' is one. Others include 'Median', 'Mode', 'Weighted Mean, 'Interquartile Mean' and many others.2

What This Means For NumPy:

Back to the topic at hand. Since NumPy is normally used in applications related to mathematics it needs to be a bit more precise about the difference between Average() and Mean() than tools like Excel which use Average() as a function for finding the 'Arithmetic Mean'.

np.mean()

In NumPy, np.mean() will allow you to calculate the 'Arithmetic Mean' across a specified axis.

Here's how you would use it:

myArray = np.array([[3, 4], [5, 6]])
np.mean(myArray)

There are also parameters for changing which dType is used and which axis the function should compute along (the default is the flattened array).

np.average()

np.average() on the other hand allows you to take a 'Weighted Mean' in which different numbers in your array may have a different weight. For example, in the documentation we can see:

>>> data = range(1,5)
>>> data
[1, 2, 3, 4]
>>> np.average(data)
2.5
>>> np.average(range(1,11), weights=range(10,0,-1))
4.0

For the last function if you were to take a non-weighted average you would expect the answer to be 6. However, it ends up being 4 because we applied the weights too it.

If you don't have a good handle on what a 'weighted mean' we can try and simplify it:

Consider this a very elementary summary of our 'weighted mean' it isn't going to be quite mathematically accurate (which I hope someone will correct) but it should allow you to visualize what we're discussing.

A mean is the average of all numbers summed and divided by the total number of numbers. This means they all have an equal weight, or are counted once. For our mean sample this meant:

(1+2+3+4+5+6+7+8+9+10+11)/11 = 6

A weighted mean involves including numbers at different weights. Since in our above example it wouldn't include whole numbers it can be a bit confusing to visualize so we'll imagine the weighting fit more nicely across the numbers and it would look something like this:

(1+1+1+1+1+1+1+1+1+1+1+2+2+2+2+2+2+2+2+2+3+3+3+3+3+3+3+3+4+4+4+4+4+4+4+5+5+5+5+5+5+6+6+6+6+6+6+7+7+7+7+7+8+8+8+8+9+9+9+-11)/59 = 3.9~

Even though in the actual number set there is only one instance of the number 1 we're counting it at 10 times its normal weight. This can also be done the other way, we could count a number at 1/3 of its normal weight.

If you don't provide a weight parameter to np.average() it will simply give you the equal weighted average across the flattened axis which is equivalent to the np.mean().

Why Would I Ever Use np.mean()?

If np.average() can be used to find the flat arithmetic mean then you may be asking yourself "why would I ever use np.mean()?" np.mean() allows for a few useful parameters that np.average() does not. One of the key ones is the dType parameter which allows you to set the type used in the computation.

For example the NumPy docs give us this case:

Single point precision: 
>>> a = np.zeros((2, 512*512), dtype=np.float32)
>>> a[0, :] = 1.0
>>> a[1, :] = 0.1
>>> np.mean(a)
0.546875 

Based on the calculation above it looks like our average is 0.546875 but if we use the dType parameter to float64 we get a different result:

>>> np.mean(a, dtype=np.float64)
0.55000000074505806

The actual average 0.55000000074505806.

Now, if you round both of these to two significant digits you get 0.55 in both cases. Where this accuracy becomes important is if you are doing multiple sets of operations on the number still, especially when dealing with very large (or very small numbers) that need a high accuracy.

For example:

((((0.55000000074505806*184.6651)^5)+0.666321)/46.778) = 231,044,656.404611

((((0.55000000074505806*184.6651)^5)+0.666321)/46.778) = 231,044,654.839687

Even in simpler equations you can end up being off by a few decimal places and that can be relevant in:

  • Scientific simulations: Due to lengthy equations, multiple steps and a high degree of accuracy needed.
  • Statistics: The difference between a few percentage points of accuracy can be crucial (for example in medical studies).
  • Finance: Continually being off by even a few cents in large financial models or when tracking large amounts of capital (banking/private equity) could result in hundreds of thousands of dollars in errors by the end of the year.

Important Word Distinction Lastly, simply on interpretation you may find yourself in a situation where analyzing data where it is asked of you to find the 'Average' of a dataset. You may want to use a different method of average to find the most accurate representation of the dataset. For example, np.median() may be more accurate than np.average() in cases with outliers and so its important to know the statistical difference.

🌐
IncludeHelp
includehelp.com › python › numpy-mean-vs-numpy-average-in-numpy.aspx
Difference Between NumPy's mean() and average() Methods
June 4, 2023 - The main difference between numpy.mean() and numpy.average() method is that the mean() performs the simple arithmetic mean operation and returns an average of the array elements, whereas, the average() performs a weighted average operation by providing weights for each element.
🌐
Statology
statology.org › home › numpy mean() vs. average(): what’s the difference?
NumPy mean() vs. average(): What's the Difference?
June 1, 2022 - Suppose we have the following array in Python that contains seven values: #create array of values data = [1, 4, 5, 7, 8, 8, 10] We can use np.mean() and np.average() to calculate the average value of this array: import numpy as np #calculate average value of array np.mean(data) 6.142857142857143 #calcualte average value of array np.average(data) 6.142857142857143
🌐
Delft Stack
delftstack.com › home › howto › numpy › np.average vs np.mean
NumPy mean() vs average() | Delft Stack
March 13, 2025 - Use Cases: Use numpy.mean() for simple average calculations where all elements contribute equally.
🌐
Arab Psychology
scales.arabpsychology.com › home › what is the difference between numpy mean() and average()?
What Is The Difference Between NumPy Mean() And Average()?
June 28, 2024 - However, there is a slight difference between the two. The mean() function calculates the average by taking the sum of all the elements in the array and dividing it by the total number of elements.
Find elsewhere
🌐
Codegive
codegive.com › blog › numpy_average_vs_mean.php
Numpy average vs mean
Weighted Average Capability: This is the most significant difference. np.mean() cannot calculate a weighted average.
🌐
JanBask Training
janbasktraining.com › community › python-python › npmean-versus-npaverage-in-python-numpy
np.mean() versus np.average() in Python NumPy? | JanBask Training Community
March 1, 2021 - 1.5K 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 ·
🌐
YouTube
youtube.com › watch
Python | NumPy Mean and Average - YouTube
The NumPy mean and average functions are used to calculate the arithmetic mean across the flattened array or a specified axis. These two functions are equiva...
Published: June 28, 2019
🌐
Codecademy Forums
discuss.codecademy.com › get help › python
Np.mean() VS np.average() - Python - Codecademy Forums
July 4, 2020 - Hi everyone, Got a very quick question about the mean and average in Python NumPy. While going through the Data Science course, they mentioned using np.average() to find the mean… but a little bit further down the road the Hint in an exercise (Variance in Weather, Task 4) suggested me to ...
🌐
Codemia
codemia.io › home › knowledge hub › np.mean vs np.average in python numpy?
np.mean vs np.average in Python NumPy? | Codemia
September 24, 2025 - numpy · python · np.mean · ... system design · Data SciencePython · np.mean and np.average both compute central tendency, but np.average supports explicit weighting....
🌐
GitHub
github.com › numpy › numpy › issues › 5507
Performance of numpy average and numpy.mean function · Issue #5507 · numpy/numpy
January 27, 2015 - I need a weightened average function on a VERY large Dataset (some 1e8 numbers or more). The numpy functions mean and average serve me well and fast, but I discovered, that numpy.average is slower than builing the weightened average myself with two numpy.mean functions, as shown by the example: https://gist.github.com/skuschel/2d148a37a2ce17925fb0 np.average(a,weights=b) takes 0.32 sec on my computer, but np.mean(a*b)/np.mean(b) takes 0.23 sec for the equally sized dataset, yielding the same result.
Author: numpy
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.average.html
numpy.average — NumPy v2.5 Manual
An array of weights associated with the values in a. Each value in a contributes to the average according to its associated weight. The array of weights must be the same shape as a if no axis is specified, otherwise the weights must have dimensions and shape consistent with a along the specified axis.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.mean.html
numpy.mean — NumPy v2.6.dev0 Manual
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.mean.html
numpy.mean — NumPy v2.5 Manual
Compute the arithmetic mean along the specified axis. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis.