I have below dataframe structure as a sample.
I want to obtain a column where it calculates the percentile of the "price column" based on the value of the "percentile" column, using a rolling n period lookback.
Is it possible? I tried using some kind of a lambda function and use the .apply syntax but couldn't get it to work.
date percentile price desired_row
2019-11-08 0.355556 0.6863 36th percentile of price of last n period
2019-11-11 0.316667 0.6851 32nd percentile of price of last n period
2019-11-12 0.305556 0.6841 ...
2019-11-13 0.302778 0.6838 ...
2019-11-14 0.244444 0.6798 ...
Thanks!!