RJT1990 / pyflux

Open source time series library for Python
BSD 3-Clause "New" or "Revised" License
2.1k stars 240 forks source link

Prediction of business days gets the wrong index #103

Open jlowin opened 7 years ago

jlowin commented 7 years ago

I believe the code for model.shift_dates() uses the difference between the last two dates to infer the next gap, but this fails when the last two dates are a Friday and a Monday. shift_dates() infers that the next prediction should be for a 3 day gap and chooses Thursday as the predicted index.

This might be the same issue as #95. (edit: never mind, I don't think it is)

I saw in an earlier issue (#1, actually) that a workaround is to use integer indices. Perhaps if users specify a Pandas DateTimeIndex with a frequency, you could use that frequency to ask for the next N dates (for example, a daily index, business day index, month end index, etc.)?

RJT1990 commented 6 years ago

Yes, it doesn't work for business days (very naive implementation with shift_dates!). Workaround in meantime is to replace the index with your own index.