I am referring to codes in the below link Identifying Extrema in Financial Data using Pandas
One of the functions has below code
def bear_market(symbol, window=90, correction = .2):
return pd.rolling_apply(symbol, window, lambda x: x[-1]/x.max() < (1-correction))
it seems rolling_apply is now replaced by rolling in python, but I am still struggling to amend this code
pd.rolling_apply(symbol, window, lambda x: x[-1]/x.max() < (1-correction))
can someone help plz