Pandas dataframe History objects should map the integer weekdays 0 to 6 from Monday to Sunday
Expected Behavior
Pandas dataframe History objects should map the integer weekdays 0 to 6 from Monday to Sunday.
See reference:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DatetimeIndex.dayofweek.html for
Actual Behavior
Instead, they appear to only return values on the range 1 to 5.
Potential Solution
I am not sure!
Reproducing the Problem
history = history.open.unstack(0) dayofweek = history.index.dayofweek check_day= history.iloc[dayofweek==0]
If you then check the length of check_day, it is empty
But,
history = history.open.unstack(0) dayofweek = history.index.dayofweek check_day= history.iloc[dayofweek==1]
Returns a number of days that seems reasonable in my lookback period of 60. (about 10)
I also checked 6, which returns nothing, and 7, which returns again nothing. But 5 returns again a reasonable number of days.
I have not checked the actual dates to check that for example, to see what dayofweek==1 maps to in terms of real calendar day of weeks. That might be worth investigating.
System Information
Running on the Online IDE on www.quantconnect.com with Python
Checklist
- [☑️ ] I have completely filled out this template
- [ ] I have confirmed that this issue exists on the current
masterbranch ( I do not know how up to date Web Lean is) - [ ☑️] I have confirmed that this is not a duplicate issue by searching issues
- [☑️ ] I have provided detailed steps to reproduce the issue