I need to find argmax index in pd.DataFrame. I want exacly the same result, as pandas.DataFrame.idxmax does, but this function returns index of first occurrence of maximum over requested axis. I want find index of last occurrence of maximum. Thank you in advance.
Asked
Active
Viewed 887 times
0
Любовь Пономарева
- 134
- 1
- 8
1 Answers
1
Run df[::-1].idxmax()
The trick is to process rows in reversed order.
Valdi_Bo
- 27,886
- 3
- 21
- 36
-
When I wrote this answer I didn't know that there is another answer (indeed, just the same). – Valdi_Bo May 25 '20 at 11:37