Closed neilsmurphy closed 3 years ago
Added test file. (tests/test_data_pandas.py)
The modification is working for regular pandas feed, but not for extended feeds. I'm losing the name in the mapping to the additional lines. Will review.
The travis error I'm receiving is Travis can't find Pandas module. However, to test this I require a pandas module. Any thoughts on how I can deal with this?
Everything seems working now with the latest commit. Still unsure how to test in Travis with the extra Pandas module. Travis seems to reject that.
@vladisld Seems all I had to do was modify the travis.yml file to include pandas in the build. All passed. Since I wrote I'll let you authorize. Thanks.
@vladisld Are we good to go with this one?
@vladisld I adjusted the travis file for the conflict. Are we still good to go?
In 2017 the numeric check was dropped from the code. However, the function (colsnumeric) for checking if the dataframe headers were numeric and not string was still in the code. But there was no use of this function any longer.
Consequently, the current workflow sees the numeric headers not being properly identified and heading into the section where the text headers get sorted and identified. The numeric headers hits a x.lower() designed for strings and an error is thrown, hence this issue.
I have reinstated now the use of the
colsnumeric
. I have added back in similar fashion (but not exactly the same) code that will set theself._colmapping
dict which gets used when iterating through the pandas lines to create the backtrader lines.The order of the columns is obviously important since there is no text to determine the lines. I have checked the historical codes as well as the docs and set the columns accordingly:
{'datetime': None, 'open': 0, 'high': 1, 'low': 2, 'close': 3, 'volume': 4, 'openinterest': 5}
datetime
being index of the dataframe.The
self.colsnumeric
bool qualifier is carried forward and used in the Transform names section instart()
. This will ensure that numeric headers skip the.lower()
error and use the second conditional inI will create some test cases but this is working so far. I have run this with numeric and text headers.