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 2,027 times
3

Любовь Пономарева
- 314
- 1
- 2
- 9
1 Answers
4
Run df[::-1].idxmax()
The trick is to process rows in reversed order.

Valdi_Bo
- 30,023
- 4
- 23
- 41
-
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