machine-learning-for-trading
machine-learning-for-trading copied to clipboard
RuntimeError: Cannot set name on a level of a MultiIndex. . Use 'MultiIndex.set_names' instead.
Describe the bug I am getting the above runtime error while executing alphalens_signals_quality.ipynb in line from Alphalens library function factor_data = get_clean_factor_and_forward_returns(factor=factor, prices=trade_prices,quantiles=5, periods=(1, 5, 10, 21)) . Appears to be a compatibility issue with pandas library .
To Reproduce
- In case you are not running the current version of the notebook/script as found on GitHub.
Steps to reproduce the behavior:
- Go to ' https://github.com/PacktPublishing/Machine-Learning-for-Algorithmic-Trading-Second-Edition/blob/master/11_decision_trees_random_forests/06_alphalens_signals_quality.ipynb'
- Execute the above file
- Scroll down to statement -
factor_data = get_clean_factor_and_forward_returns(factor=factor, prices=trade_prices,quantiles=5, periods=(1, 5, 10, 21)) . - See error [ attached screenshot ]
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Environment
I am using - OS: Windows 10 alphalens-0.3.6 pandas 1.3.5 python 3.7

Additional context Add any other context about the problem here.