-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Fix errors in pandas.Series.argmax #32019
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
Changes from 1 commit
9bffeac
9eda7cd
64e814f
32e3911
c46e2ff
8f7843d
e44f592
9d8f863
878dcc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -929,11 +929,17 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs): | |
""" | ||
Return an ndarray of the maximum argument indexer. | ||
|
||
If multiple values equal the maximum, the first row label with that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the maximum is achieved in multiple locations, the first such location is returned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we should go with location instead of row position? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "row position" sounds good. Definitely not "row label". |
||
value is returned. | ||
|
||
Parameters | ||
---------- | ||
axis : {None} | ||
Dummy argument for consistency with Series. | ||
skipna : bool, default True | ||
Exclude NA/null values when showing the result. | ||
*args, **kwargs | ||
Additional arguments and keywords for compatibility with NumPy. | ||
|
||
Returns | ||
------- | ||
|
@@ -942,7 +948,22 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs): | |
|
||
See Also | ||
-------- | ||
numpy.ndarray.argmax | ||
numpy.ndarray.argmax : Returns the indices of the maximum values along an axis. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a pandas There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would this be sufficient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good. I'm not sure if the And for the descriptions, it could make sense to say something like "Equivalent method for numpy arrays.", "Same, but returning the minimum". I think for users could be easier to understand what those methods do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I've noticed through I agree with your proposed descriptions, as current description is redundant with each function description |
||
|
||
Examples | ||
-------- | ||
>>> s = pd.Series(data=[1, None, 5, 4, 5], | ||
... index=['A', 'B', 'C', 'D', 'E']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think you can find some data that looks more "real". In Also, may be worth adding a note saying that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'm gonna use cereal calories dataset as an example and adding that note. |
||
>>> s | ||
A 1.0 | ||
B NaN | ||
C 5.0 | ||
D 4.0 | ||
E 5.0 | ||
dtype: float64 | ||
|
||
>>> s.argmax() | ||
2 | ||
""" | ||
nv.validate_minmax_axis(axis) | ||
nv.validate_argmax_with_skipna(skipna, args, kwargs) | ||
|
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.
is this sentence accurate? it looks like we return an int, not ndarray
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.
(also relevant for the Returns section)
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.
Do you think this okay?
And also change for the Returns section:
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.
"maximum argument indexer" is awkward. how about "Returns int position of the largest value in the Series"
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 think this one is easier to understand.