-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
DateTimeIndex warning #329
Comments
Hello @Hussam1, This line of code is causing the problem Check how import yfinance as yf
import datetime as dt
spxl = yf.Ticker("SPXL")
hist = spxl.history(start="2015-01-01")
hist = hist.asfreq("D")
print(hist.index) DatetimeIndex(['2015-01-02 00:00:00-05:00', '2015-01-03 00:00:00-05:00', data = hist.dropna()
print(data.index) DatetimeIndex(['2015-01-02 00:00:00-05:00', '2015-01-05 00:00:00-05:00', |
Thanks @JavierEscobarOrtiz for the response. Problem is sometimes filling the "gap" might not be optimal or correct from business case prospective, for instance in this situation trading happen only in business days and it will distort the purpose to assume any results in the "gap" days. even if we take Edit: I tested your answer, yes by filling the gap with any figures the error is gone but how would you solve the problem of having to fill the gap when it doesn't make sense business wise, for instance if a company doesn't have sales every day and you still need to model the daily sales? of course you can always resample till higher frequency but don't you think this is a limitation of the library? |
Hi @Hussam1, Forecasting with missing values is always a challenge. How to solve it depends a lot on the business case. Based on what you are explaining, it may make sense to propagate the value of the last business day. You may also benefit from the weighted time series forecasting feature that skforecast offers. https://www.cienciadedatos.net/documentos/py46-forecasting-time-series-missing-values.html |
Hello @Hussam1, Yes, you are right. One of the main limitations of an autoregressive model is that the series cannot be incomplete. Since the prediction Along with @JoaquinAmatRodrigo's solutions, I think another one can be tried:
|
Thanks you very much @JoaquinAmatRodrigo @JavierEscobarOrtiz for your answers and suggestions. I agree for company's sales business case (which is the real case for me) propagating last business day's sales might be good option in addition to resampling to a higher frequency such as weekly/monthly. I appreciate the efforts you put in this library, it is super helpful! |
I am having warning of:
UserWarning:
y
has DatetimeIndex index but no frequency. Index is overwritten with a RangeIndex of step 1Although the index is: DateTimeIndex, and the frequency is defined as "D"
if I try to replicate ur codes for LGBMRegressor:
The text was updated successfully, but these errors were encountered: