Closed mmargenot closed 6 years ago
@mmargenot as it is related to this commit, would you remove the rolling_apply inside utils.py as well?
Current code
sub_portfolios = pd.rolling_apply(sub_portfolios,
period,
rate_of_returns,
min_periods=1,
args=(period,))
That should become:
sub_portfolios = sub_portfolios.rolling(window=period, min_periods=1) \
.apply(rate_of_returns, args=(period,))
Thanks @mmargenot, changing the requirement to >= 0.18 is fine.
CC @richafrank.
Thanks. The requirement bump to 0.18 sounds good to me, as that matches the lower bound for zipline.
I assume the pandas API change here is in fact supported by 0.18? Confirming only because the travis build is testing with latest pandas (0.20).
Yeah, I was worried about that too but thought I misremembered. I don't think 0.18 supports .rolling().mean()
yet.
Should probably also add a test-matrix for older pandas versions here.
@luca-s I can definitely fix the rolling_apply
. I just wanted to get this one first.
Thanks @mmargenot!
I changed the instances of
rolling_mean
to use the new API. The instances ofrolling_apply
that are used elsewhere should be updated on top of these.