-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Converting heatmap series to dataframe #101
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
Comments
Can you show an example of an inadequate and a proposed adequate result? Not sure I get it. When stats, heatmap = bt.optimize(..., return_heatmap=True) You can easily convert a pandas series to a dataframe: heatmap = heatmap.to_frame() |
Again, to get a frame, have you tried running: heatmap = heatmap.to_frame('My Equity') ? One simple way to get the best combinations is to run: heatmap.sort_values() Indeed, assigning backtesting.py/backtesting/backtesting.py Lines 816 to 818 in 0739f4b
Additionally, >>> stats._strategy.thersold_buy
2 |
Yes i did, and the dataframe that is output has different row numbers between columns.
here comes my lack of python knowledge 'by' the column i want to sort for has no name.... Regarding the method of using Many thanks for your help. |
This should work on initial |
Ok, having run it, I understand. Merely: heatmap.to_frame() retains the MultiIndex. Instead try: heatmap.reset_index(name='Equity') |
example: |
Expected Behavior
stats should be a dataframe with all the parameters and all the results with properly named columns
Actual Behavior
stats is pandas series of different lenght, and the optimizing paramenter(in the example Equity) is missing label.
Steps to Reproduce
Additional info
I think that the the heatmap should be a full pandas dataframe with properly named columns and with run number as index. Currently it's quite tricky to get the best parameters for a simulation with aloto of paramers, haveing a proper dataframe as heatmap would really help.
Latest
The text was updated successfully, but these errors were encountered: