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.

Answer from AdamSC 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 - In this article, we have shown the basic use case of both functions and how they are different from each other. In numpy library, np.mean() is a function used to calculate arithmetic mean of the given array along with the axis.
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.

Discussions

When shoud I use numpy.mean and numpy.average? - Stack Overflow
I thought the two were basically the same, since they both compute the average of the data. Yet some of the arguments seems to be different on the offical documentation, it seems as though numpy.average can be used to get weighted averages while we cannot on numpy.mean. More on stackoverflow.com
🌐 stackoverflow.com
Performance of numpy average and numpy.mean function
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 ... More on github.com
🌐 github.com
4
January 27, 2015
Alternative to np.mean() with better performance?
There is almost never a reason to take a mean on a vector so large that run time is a concern except for if the distribution of values has a near infinite/undefined standard deviation. Do this: randomly sample 100000 (or 10000) points from the vector. (Numpy random choice) Take the mean. Observe it is basically the same value as the full data sample. The sample mean converges rapidly with the population mean under a general set of conditions. And for most applications a big sample will suffice. So anyway I question the need to calculate a mean that takes numpy 5 seconds. More on reddit.com
🌐 r/learnpython
32
9
November 27, 2023
Starting to use numpy and was curious about getting the mean for each row and each column? I don't really understand the axis's fully.
Check out the NumPy documentation on the mean method . You'll see in the example given that axis=None returns the mean of every element in the array. axis=0 returns the mean of each column as an array. axis=1 returns the mean of each row as an array. You can confirm this by creating a non-square matrix, say 3x4 (3 rows by 4 columns). When you take np.mean of that matrix with axis=0, you'll get a 1-dimentional array with 4 elements. When you take np.mean with axis=1, you'll get a 1-dimensional array with 3 elements. With a small matrix like this, you can also hand-compute the means and confirm that NumPy is giving you the column or row means depending on your choice of axis. If you're not already doing so, I strongly recommend using Jupyter notebooks to quickly test small snippets of code. If you're not sure how something like np.mean works, you can throw a test into a notebook and get instant feedback on your test. That's how I did the test I described in the second paragraph. (FWIW, the plural of "axis" is "axes". I'm normally not this pedantic on reddit, but I'm learning that clear communication when talking about code goes a long way to minimizing confusion, so I feel like it's worth pointing out here.) More on reddit.com
🌐 r/learnpython
12
1
June 13, 2022
🌐
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 - Since we did not provide the value of the parameter axis in the preceding code, the mean of the flattened array is calculated by default. ... numpy.average(), on the contrary, allows you to compute a Weighted Mean, with each value in your array having a distinct weight.
🌐
Statology
statology.org › home › numpy mean() vs. average(): what’s the difference?
NumPy mean() vs. average(): What's the Difference?
June 1, 2022 - import numpy as np #calculate weighted average of array np.average(data, weights=(.1, .2, .4, .05, .05, .1, .1)) 5.45 · The weighted average turns out to be 5.45. Here is the formula that np.average() used to calculate this value: Weighted Average = 1*.1 + 4*.2 + 5*.4 + 7*.05 + 8*.05 + 8*.1 + 10*.1 = 5.45. Note that we could not use np.mean() to perform this calculation since that function doesn’t have a weights parameter.
🌐
IncludeHelp
includehelp.com › python › numpy-mean-vs-numpy-average-in-numpy.aspx
Difference Between NumPy's mean() and average() Methods
June 4, 2023 - The numpy.mean() method is used to compute the arithmetic mean along with the specified axis, whereas, the numpy.average() method is used to compute the weighted average along the specified axis. Both of the methods are of numpy library and work on the numpy arrays.
🌐
Delft Stack
delftstack.com › home › howto › numpy › np.average vs np.mean
NumPy mean() vs average() | Delft Stack
March 13, 2025 - The numpy.mean() function is designed to compute the arithmetic mean of an array. It takes a single array as input and returns the average value of its elements.
Find elsewhere
🌐
Codegive
codegive.com › blog › numpy_average_vs_mean.php
Numpy average vs mean
However, in statistics and numerical computing, "average" can be a broader term that encompasses various types of averages, including the arithmetic mean, median, mode, and crucially, the weighted average. NumPy's np.mean() strictly calculates the arithmetic mean.
🌐
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.
🌐
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.
🌐
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 - 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 ·
🌐
Reddit
reddit.com › r/learnpython › alternative to np.mean() with better performance?
Alternative to np.mean() with better performance? : r/learnpython
November 27, 2023 - There is almost never a reason to take a mean on a vector so large that run time is a concern except for if the distribution of values has a near infinite/undefined standard deviation. Do this: randomly sample 100000 (or 10000) points from the vector. (Numpy random choice) Take the mean.
🌐
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 - The key difference is semantic intent. Use mean for unweighted arithmetic mean and average when sample importance varies.
🌐
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.
🌐
TutorialsPoint
tutorialspoint.com › numpy › numpy_statistical_functions.htm
NumPy - Statistical Functions
Our array is: [[1 2 3] [3 4 5] ... along axis 1:[2. 4. 5.] The numpy.average() function computes the weighted average of elements in an array according to their respective weight....
🌐
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.