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

MultiAssetPurgedKFold and MultiAssetCombinatorialPurgedKFold are throwing TypeError: '>=' not supported between instances of 'tuple' and 'str' #522

Open
brandonyano opened this issue Jul 27, 2022 · 0 comments

Comments

@brandonyano
Copy link

Describe the bug
MultiAssetPurgedKFold and MultiAssetCombinatorialPurgedKFold are throwing TypeError: '>=' not supported between instances of 'tuple' and 'str' when using a stacked multi-asset dataframe, the error doesn't occur if you only send one asset at a time.

To Reproduce

idx = pd.MultiIndex.from_product([['AAPL', 'MSFT', 'TSLA'],
                                  ['2006-03-28 10:46:00', '2006-03-28 14:35:00', '2006-03-28 21:08:00']],
                                 names=['asset', 'date_time'])

t1_events = pd.DataFrame('2006-03-29 10:46:00', idx, ['t1'])
prices = pd.DataFrame(100, idx, ['price'])

cv = MultiAssetPurgedKFold(n_splits=5, samples_info_sets=t1_events["t1"], pct_embargo=0.01)

splits = []
for train, test in cv.split(prices):
    splits.append((train, test))

Screenshots
image

Desktop (please complete the following information):

  • mlfinlab v1.6.0
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