Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Much faster code for aroon #19

Open
cynseok opened this issue Jun 18, 2018 · 0 comments
Open

Much faster code for aroon #19

cynseok opened this issue Jun 18, 2018 · 0 comments

Comments

@cynseok
Copy link

cynseok commented Jun 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant