This is question is similar to the one I have posted here. But with a little different framework.
Let's say I have the pandas data frame:
d = {'a': [12, 3, 5, 2, 10, 3, 5, 4, 2]}
df = pd.DataFrame(data=d)
df
I want to count a total number of rows, between the first and the second max values of column a. In this case, it will be 3, which is the number of rows between 12 and 10. How can one do it more generically?
Thanks