-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
argmin/argmax, idxmin/idxmax and datetime64 #2982
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
yep....I had change a few things... |
thanks for the bug report...fixed in the pr above (and it fixes the failing test on 32-bit in argsort) ....in your example, |
I think u can close this and if u want to open an issue about argmin/max |
idxmax/idxmin are fine now! So i In [76]: s
Out[76]:
a 2013-01-02 00:00:00
b 2013-01-03 00:00:00
c 2013-01-04 00:00:00
d 2013-01-05 00:00:00
e NaT
dtype: datetime64[ns]
In [77]: s.idxmin()
Out[77]: 'a'
In [78]: s.idxmax()
Out[78]: 'd' Thanks! |
I'm getting the same issue with Pandas v0.11 stable on a DataFrame with dtype object (but it only contains float64 values), and also argmax() seems to have been deleted, it's not available anymore for DafaFrame. /EDIT: Just casted the DataFrame into a float64 and it works again. But it's weird that idxmax() fails with object dtype with the error above, maybe another conditional check may be added to avoid failing like this? |
you cannot use dtype of object (well you can), but it won't work well with datetimelike, use |
Thank you jreback but it's ok, my DataFrame is in fact only composed of floats (or strings which are only composed of numbers but then it's ok) and thus recasting into floats solved the problem, but it was weird because Pandas automatically casted my DataFrame as an object when there are only floats inside, that's why I was a bit surprised. |
@lrq3000 glad that it worked, but as a general rule, |
Related: numpy/numpy#5610 |
The text was updated successfully, but these errors were encountered: