Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Outdated example of DataFrame.mean #61070

Closed
1 task done
rafael-patronilo opened this issue Mar 6, 2025 · 1 comment
Closed
1 task done

DOC: Outdated example of DataFrame.mean #61070

rafael-patronilo opened this issue Mar 6, 2025 · 1 comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@rafael-patronilo
Copy link

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.mean.html#pandas.DataFrame.mean

Documentation problem

The second example specifies no axis and shows the mean for each column. According to the documentation above, the behavior when the axis is not specified should be to aggregate the mean over both axis since version 2.0.0

I didn't check if the same mistake is present in other aggregation functions.

Suggested fix for documentation

Replace df.mean() with df.mean(axis=0) on the example.

@rafael-patronilo rafael-patronilo added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 6, 2025
@rafael-patronilo
Copy link
Author

I think I misunderstood the docs; I think it is only if you specify df.mean(axis=None) that it aggregates over both axes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

1 participant