-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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: Improve the docstring of argsort. #19885
Conversation
add a new workflow
Updated the docstring for argsort to make it hopefully more clearer
The general docstring convention we (and most other Python packages) follow is to have the first paragraph be a one-line sentence. More detail like this should be in the following paragraphs. We already describe this in prose in the subsequent paragraph, so I would expand on this there. When you include inline code examples, we use double-backticks to make sure that they get rendered with code fonts appropriately.
Instead of |
Not sure what's going on with CI but it's unrelated to this PR. |
@vsnupoudel Please implement @rkern's suggestion. Also keep lines < 80 characters in length. |
I am inclined to close this. The added information does not enhance what is already in the |
Accepting suggested changes Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
We get enough "bug reports" of @vsnupoudel As mentioned, code snippets (and references to variables in those snippets) need to be quoted with double-backticks for proper formatting. See how we do it in the |
And an example right after the one liner at the top would be nice. Maybe I wil modify the first example as well. |
By the way, by "clarifying example", I just meant the inline |
These were the use cases that I searched ´´argmax()´´ like function for.
Index of the 4th largest element in an unsorted 1D array. | ||
|
||
>>> x = np.array(1, 2, 0, 3, 4, 5]) | ||
>>> np.argsort(x)[-4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of these examples is to show the output. I would just show the result of x[np.argsort(x)]
instead of these two examples.
This PR was against the wrong branch (build_test), I changed it to main, but maybe it should be closed.. |
@vsnupoudel gentle ping, do you have plans to update this PR? |
Hi there, |
Updated the docstring for argsort to make it hopefully more clearer