In a dataframe, I would like to count how many of the prices from the previous 10 days are greater than today's price. Result would look like this:
price ct>prev10
50.00
51.00
52.00
50.50
51.00
50.00
50.50
53.00
52.00
49.00
51.00 3
I have seen this post answered by DSM, but the requirement was different in that the base for comparison was a static number as opposed to the current row:
Achieving "countif" with pd.rolling_sum()
Of course I would like to do this without looping through 1x1. Pretty much stumped - thanks in advance for any advise.