See clone code. Essentiallly I am importing pandas and numpy and issuing unstack on a dataframe resulted from functions found on these two libraries and comparing it with the results from using unstack on a history dataframe. As a reference, in my eyes, the arrange or dataframe resulted from pandas/numpy is dimensionally the same as the dataframe resulted from history. So I am not sure why, after unstack, the shifting on the arrangement of colums/indexes on one output differs from the other.
Specifically, I was expecting self.u (unstacked dataframe from pandas/numpy) shifting of its indexes/columns to "look" the same as self.uncz (unstacked dataframe from history/close price). Am I erroneous on seeking a similarity on the output between these two "unstacked" dataframes if they have been created from different mechanisms?
Any insights/comments will be greatly appreciated.
Thanks,
Eduardo Valdivia
Adding clone of code/ backtest
Eduardo Valdivia
Not sure why I can't add the clone of the code and/or backtest
Eduardo Valdivia
Adding my code
Adding my Log file, highlighting my point
Derek Melchin
Hi Eduardo,
The DataFrame returned from the `unstack` call has its columns alphabetically sorted. See the attached backtest for reference, where the column named 'one' has been updated to 'zone'.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Eduardo Valdivia
Thanks. I was not aware of unstack reordering alphabetically. Thanks so much!
Eduardo Valdivia
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!