Skip to content

DOC: Add example to amax docstring #24676

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

Closed
wants to merge 3 commits into from

Conversation

ankur0904
Copy link
Contributor

Added example to the amax function of fromnumeric.py. #22266
@InessaPawson Please have a look.

--------
>>> np.amax([4])
4
>>> np.amax([4,-1, 67, 89])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
>>> np.amax([4,-1, 67, 89])
>>> np.amax([4, -1, 67, 89])

4
>>> np.amax([4,-1, 67, 89])
89
>>> np.amax([[1,2,3,46,44],[2,3,4,55,5]], axis=0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
>>> np.amax([[1,2,3,46,44],[2,3,4,55,5]], axis=0)
>>> np.amax([[1, 2, 3, 46, 44], [2, 3, 4, 55, 5]], axis=0)

I prefer the example to follow pep8. (not sure this is required, but the example at https://numpydoc.readthedocs.io/en/latest/format.html#examples follows the style as well)

@ankur0904
Copy link
Contributor Author

@eendebakpt I have made the required changes.

89
>>> np.amax([[1, 2, 3, 46, 44],[2, 3, 4, 55, 5]], axis=0)
array([2, 3, 4, 55, 44])
>>> np.amax([[1, 2, 3, 46, 44],[2, 3, 4, 55, 5]], axis=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
>>> np.amax([[1, 2, 3, 46, 44],[2, 3, 4, 55, 5]], axis=1)
>>> np.amax([[1, 2, 3, 46, 44], [2, 3, 4, 55, 5]], axis=1)

@ankur0904
Copy link
Contributor Author

@eendebakpt I made the suggested change.

Copy link
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

The docstring makes clear that amax is an alias for max. I'd vote to continue referring users to the np.max documentation rather than add explicit examples here.

@ankur0904
Copy link
Contributor Author

@rossbar Alright.

@rossbar
Copy link
Contributor

rossbar commented Sep 12, 2023

Thanks @ankur0904 , I'll go ahead and close this.

@rossbar rossbar closed this Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants