Open cynseok opened 6 years ago
def aroon_up(data, period): return (1 + data.rolling(period).apply(lambda x: pd.Series(x).idxmax(skipna = True))) / period * 100
def aroon_down(data, period): return (1 + data.rolling(period).apply(lambda x: pd.Series(x).idxmin(skipna = True))) / period * 100
data must be a pandas.Series object - we could wrap it as pd.Series(data) first.
Current code executes at around 8 seconds on 16285 rows of data. Code above executes at around 1.36 seconds
def aroon_up(data, period): return (1 + data.rolling(period).apply(lambda x: pd.Series(x).idxmax(skipna = True))) / period * 100
def aroon_down(data, period): return (1 + data.rolling(period).apply(lambda x: pd.Series(x).idxmin(skipna = True))) / period * 100
data must be a pandas.Series object - we could wrap it as pd.Series(data) first.
Current code executes at around 8 seconds on 16285 rows of data. Code above executes at around 1.36 seconds