-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
argmax? #2970
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
Comments
Series.idxmax |
Thought so. Odd name. Thanks. |
An idea for a possibly more memorable name: findmax, a la array_max_idx = matplotlib.mlab.find( max( array ) ) On Tue, Mar 5, 2013 at 7:38 AM, Skipper Seabold [email protected]:
Matthew Turner |
The names were originally |
That makes sense. I didn't even see argmax/argmin before, though how I missed these is a mystery because I swear I looked... |
the original argument for not naming |
argmin and argmax are pretty standard imho, esp in optimization where On Tue, Mar 5, 2013 at 1:13 PM, jreback [email protected] wrote:
Matthew Turner |
@jreback idxmin/idxmax return label whereas argmin/argmax return location. I think this was the main reason why Wes did not want to override. Since override is not done, both exist - at least on Series, same names idxmin/idxmax are kept on DataFrame. In [33]: s = pd.Series([10, 30, 20], list('abc'))
In [34]: s
Out[34]:
a 10
b 30
c 20
In [35]: s.idxmax()
Out[35]: 'b'
In [36]: s.argmax()
Out[36]: 1 |
I was using an integerr index, so you are correct :) in any event, I believe np.argmin of a series of datetime64[ns] with NaT is wrong (in 0.11-dev), worked in 0.10.1 becuase shifted datetime64[ns] was object dtype.... so I think we SHOULD add support for argmax/min directly |
created #2982 for datetime64[ns] |
Before I make a PR, is there an existing argmax anywhere? I often find myself wanting an easier way of asking for the argmax in a series, and I don't see a way to do it easily. From experience, this doesn't mean it doesn't exist.
The text was updated successfully, but these errors were encountered: