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

Triple barrier events code returning IndexError 0 out of bounds #531

Open
the57chambers opened this issue Feb 8, 2023 · 2 comments
Open

Comments

@the57chambers
Copy link

Running through the triple barrier labeling process, the code keeps getting an error

"IndexError: index 0 is out of bounds for axis 0 with size 0" - i take it this means it is trying to pull from an empty dataframe, but i have checked each of the inputs (cusum, ptsl, target,verticalbarriertimes, ES and Side) and they all have data. there are also no NaN, inf, NaT or other blank values or error in the dataframe. Any idea what could be causing this?

Code:

triple_barrier_events = ml.labeling.get_events(close=data['ES'],
t_events=cusum_events,
pt_sl=pt_sl,
target=daily_vol,
min_ret=min_ret,
num_threads=3,
vertical_barrier_times=vertical_barriers,
side_prediction=data['side'])

Copy link
Member

Jackal08 commented Feb 8, 2023

Have you checked for duplicates in the index?

@the57chambers
Copy link
Author

Yes, i ran numerous functions to remove problematic values but am still getting the same error, see below for the adjustments i tried:
data = data.dropna()
cusum_events = cusum_events.dropna()
vertical_barriers = vertical_barriers.dropna()
daily_vol = daily_vol.dropna()
data = data.drop_duplicates()
cusum_events = cusum_events.drop_duplicates()
daily_vol = daily_vol.drop_duplicates()

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

2 participants