Skip to content

DOC: Improve what the axis= kwarg does for generic methods #37029

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

Merged
merged 3 commits into from
Oct 12, 2020

Conversation

hongshaoyang
Copy link
Contributor

@hongshaoyang hongshaoyang commented Oct 10, 2020

axis=0 or axis=1, which is it?

Opening a PR to discuss #29203 on what it means to do df.sum(axis=0) versus df.sum(axis=1). The docs does not make it intuitively clear to the user. I propose a simple change where "summing acrossaxis=0" makes it clear that you're summing across indexes (i.e. column sums).

Copy link
Member

@arw2019 arw2019 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hongshaoyang for the PR!

I agree this is worth improving. However, I think that a better preposition would be along or over rather than across. See, for example, the numpy docs for np.sum:
https://numpy.org/doc/stable/reference/generated/numpy.sum.html#numpy.sum

I'm -1 on this as is

@hongshaoyang
Copy link
Contributor Author

Thank you @arw2019 for the review! I agree that "over" is clearer, and have changed accordingly.

@hongshaoyang
Copy link
Contributor Author

hongshaoyang commented Oct 10, 2020

Thanks for the approval! May I get this PR labelled as hacktoberfest-accepted?

See #36837 and here.

@rhshadrach rhshadrach added hacktoberfest-accepted Docs Numeric Operations Arithmetic, Comparison, and Logical operations labels Oct 10, 2020
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; I've verified this takes care of all docs that use the phrase "requested axis".

@jreback
Copy link
Contributor

jreback commented Oct 10, 2020

can you merge master (and ping on green), we just moved a lot of this around.

@jreback jreback added this to the 1.2 milestone Oct 11, 2020
@hongshaoyang
Copy link
Contributor Author

all checks passing @jreback

@jreback jreback merged commit efa80f3 into pandas-dev:master Oct 12, 2020
@jreback
Copy link
Contributor

jreback commented Oct 12, 2020

thanks @hongshaoyang

@hongshaoyang hongshaoyang deleted the personal/shaoyang branch October 12, 2020 15:35
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Oct 26, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve docs on what the axis= kwarg does in individual functions/methods
4 participants