If you only want the mean of the weight column, select the column (which is a Series) and call .mean():

In [479]: df
Out[479]: 
         ID  birthyear    weight
0    619040       1962  0.123123
1    600161       1963  0.981742
2  25602033       1963  1.312312
3    624870       1987  0.942120

In [480]: df.loc[:, 'weight'].mean()
Out[480]: 0.83982437500000007
Answer from DSM on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.mean.html
pandas.DataFrame.mean — pandas 3.0.6 documentation
>>> df = pd.DataFrame({"a": [1, 2], "b": [2, 3]}, index=["tiger", "zebra"]) >>> df a b tiger 1 2 zebra 2 3 >>> df.mean() a 1.5 b 2.5 dtype: float64
Discussions

[pandas] df.mean() gives different results to calculating mean in Excel?
Ah ****. I've just realised exactly what's causing this. batting_df.mean() was including the Totals row. The reason it was pretty much double, was because everything was being added up twice, then divided by n+1 instead of n*2. What an idiot. More on reddit.com
🌐 r/learnpython
3
6
August 18, 2021
In a pandas dataframe, how to find the average value within specific categories as denoted in another column. See example in the description.
GroupBy in Pandas More on reddit.com
🌐 r/learnpython
3
1
May 27, 2023
Mean of a list of Series [Pandas]
if I understand correctly, each element in the Series is a list of 2 numbers. s = Series([ [1.5, 2], [3.4, 15] ]) So you should be able to apply a function to perform the calculation you need s.apply(lambda x: sum(x) / len(x)) More on reddit.com
🌐 r/learnpython
4
3
August 2, 2022
Is Numpy always more efficient than Pandas? And how much should we rely on Python anyway?
as long as you dont use pandas in "dumb ways", dont worry. here you go: https://ryxcommar.com/2020/01/15/for-the-love-of-god-stop-using-iterrows/ More on reddit.com
🌐 r/datascience
95
196
December 10, 2021
🌐
Medium
medium.com › @amit25173 › understanding-pandas-average-a-practical-guide-f2697cc6a75f
Understanding pandas average: A Practical Guide | by Amit Yadav | Medium
April 12, 2025 - What is the pandas average function? The pandas average function, commonly referred to as mean(), calculates the arithmetic mean of a specified data collection, such as a Series or DataFrame.
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › how to get column average or mean in pandas dataframe
How to Get Column Average or Mean in Pandas DataFrame - Spark By {Examples}
December 12, 2024 - To get column average or mean from pandas DataFrame use either mean() or describe() method. The mean() method is used to return the mean of the values
🌐
Saturn Cloud
saturncloud.io › blog › what-is-pandas-mean-for-a-certain-column
What is Pandas Mean for a Certain Column | Saturn Cloud Blog
May 1, 2026 - In this blog post, we’ll explore ... First, let’s define what the mean() function does. In statistics, the mean is the average value of a set of numbers....
🌐
IONOS
ionos.ca › digital guide › websites › web development › python pandas: dataframe mean
How to calculate averages with pandas mean()
June 26, 2025 - The DataFrame.mean() function in Python pandas is used to calculate averages across one or more axes of a DataFrame. Pandas mean() is essential for analyzing numerical data.
Find elsewhere
🌐
Medium
medium.com › @heyamit10 › what-is-mean-in-pandas-59f1a55934b4
What is mean() in Pandas?. I understand that learning data science… | by Hey Amit | Medium
March 6, 2025 - By default (skipna=True), Pandas ignores NaN values while calculating the mean. If you set skipna=False, it includes NaN in the calculation, which results in NaN because you can’t compute an average with missing data.
🌐
Statology
statology.org › home › numpy mean() vs. average(): what’s the difference?
NumPy mean() vs. average(): What's the Difference?
June 1, 2022 - 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.
🌐
W3Schools
w3schools.com › python › pandas › ref_df_mean.asp
Pandas DataFrame mean() Method
Pandas Editor Pandas Quiz Pandas Exercises Pandas Syllabus Pandas Study Plan · DataFrames Reference · ❮ DataFrame Reference · Return the average (mean) value for each column: import pandas as pd data = [[1, 1, 2], [6, 4, 2], [4, 2, 1], [4, 2, 3]] df = pd.DataFrame(data) print(df.mean()) Try it Yourself » ·
🌐
Reddit
reddit.com › r/learnpython › [pandas] df.mean() gives different results to calculating mean in excel?
r/learnpython on Reddit: [pandas] df.mean() gives different results to calculating mean in Excel?
August 18, 2021 -

EDIT: RESOLVED. I was being a complete moron. See comment if you want a laugh.

Here's the situation: I've webscraped some sports stats and saved them in a DF. I then add a new row which calculates the mean of each column (mean number of hits, runs, etc). I then save the data to CSV.

When looking at the data in Excel, I noticed that the means looked off. I calculated them in Excel (using both =sum(firstCell:lastCell)/#rows and =AVERAGE(firstCell:lastCell). Both of those methods agreed with each other, but were wildly different (and at a glance, closer to what I'd expect) than the df.mean() values

Here's the Python code (I've shortened the paths for brevity but they're operational in the real code):

import pandas as pd
from pathlib import Path

DATA_DIR = "[...]/data"
p = Path(DATA_DIR)

def read_data():
    lst = pd.read_html(f"[...]/batting")
    df = lst[0]
    df = df.fillna(0)
    return df

batting_df = read_data()
batting_df.loc['lgAvg'] = batting_df.mean()
# Then export to CSV.

I've just noticed, having looked at them more closely, that the lgAvg values are pretty much (but not always exactly) double the =AVERAGE() values from Excel. They're double to within 1 DP.

Any idea what's causing this?

🌐
Codegive
codegive.com › blog › pandas_mean_average.php
Mastering Pandas Mean Average: Unlock Data Insights & Boost Your Analysis Skills!
The pandas mean average refers to the calculation of the arithmetic average of numerical data stored in pandas Series or DataFrame objects. In statistics, the mean is the sum of all values divided by the number of values. Pandas provides a highly optimized and flexible .mean() method that ...
🌐
TheLinuxCode
thelinuxcode.com › home › calculating the average: an in-depth guide to pandas mean
Calculating the Average: An In-Depth Guide to Pandas Mean – TheLinuxCode
December 27, 2023 - So you want to find the average value across your data using Python‘s handy Pandas library. Getting the arithmetic mean seems simple—just add up all the numbers and divide by the count. But there‘s a lot of subtle complexity hidden inside that simple Pandas .mean() method!
🌐
Linux Hint
linuxhint.com › pandas-average
Linux Hint – Linux Hint
August 19, 2022 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
Programiz
programiz.com › python-programming › pandas › methods › mean
Pandas mean() (With Examples)
With skipna=False, columns A, B, and D contain None, so their means are NaN, while column C has no None, so its average is calculated.
🌐
LearnModernPython
learnmodernpython.com › home › mastering the pandas dataframe mean() method: the ultimate guide
Mastering The Pandas DataFrame Mean() Method: The Ultimate Guide
April 9, 2026 - By default, Pandas ignores it and calculates the average of the remaining three numbers. One of the most common points of confusion for beginners is the axis parameter. Let’s break it down clearly.
🌐
datagy
datagy.io › home › pandas tutorials › data analysis in pandas › pandas mean: calculate pandas average for one or multiple columns
Pandas Mean: Calculate the Pandas Average • datagy
December 15, 2022 - Learn how to calculate the Pandas mean (or Pandas Average), including how to calculate it on a column, dataframe, and row, and with nulls.
🌐
Leverage
leverage.to › learn › data › pandas-functions › mean-get-average-pd-dataframe-mean
Pandas Mean – Get Average pd.DataFrame.mean() - Leverage
Pandas Mean will return the average of your data across a specified axis. If the function is applied to a DataFrame, pandas will return a series with the mean across an axis.