【发布时间】:2019-11-14 17:52:32
【问题描述】:
我有以下数据框结构作为示例。
我想获得一个列,它使用滚动 n 周期回溯,根据“百分位”列的值计算“价格列”的百分位。
有可能吗?我尝试使用某种 lambda 函数并使用 .apply 语法,但无法使其工作。
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 ...
谢谢!!
【问题讨论】:
标签: python pandas dataframe percentile