-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DOC: #22266 Add examples for tril_indices_from(), triu_indices_from() #22562
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
Conversation
Thanks. The tests are failing here, so it seems one of the example output is wrong. The lines should also be kept shorter (the linter is unhappy due to this), that probably means a slightly differently formatted output (if the output is always like this, then we can ignore that). |
close/reopen |
The examples seem to be incorrect, hence the test failures. |
* incides -> indices * Update wording surrounding .
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.
I took the liberty of pushing up a fix to the failing docstring example. A couple minor subjective comments about potentially shortening things by the calling of other functions from the examples, but that's just an opinion. There's nothing to be done about the failing linter as the line length is dicated by the example output.
I'll put this in once CI passes. Thanks @richierocks !
This is syntactic sugar for tril_indices(). | ||
|
||
>>> np.tril_indices(a.shape[0]) | ||
(array([0, 1, 1, 2, 2, 2, 3, 3, 3, 3]), array([0, 0, 1, 0, 1, 2, 0, 1, 2, 3])) | ||
|
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.
I'd prefer to remove this in favor of the See Also reference to tril_indices
immediately below the examples, but it's not a blocker.
This is syntactic sugar for triu_indices(). | ||
|
||
>>> np.triu_indices(a.shape[0]) | ||
(array([0, 0, 0, 0, 1, 1, 1, 2, 2, 3]), array([0, 1, 2, 3, 1, 2, 3, 2, 3, 3])) | ||
|
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.
Same here
Add examples for tril_indices_from(), triu_indices_from() as requested by #22266.
Written as part of PyData 2022 sprint.