-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
BUG: Check freq
only when useful in forecasting.
#7565
Comments
Running the code below on master produces no errors. from statsmodels.tsa.holtwinters import ExponentialSmoothing as HWES
import numpy as np
y = np.random.standard_normal(144*1000)
#build and train the model on the training data
model = HWES(y, seasonal_periods=144, trend='add', seasonal='add')
fitted = model.fit(optimized=True, use_brute=True)
#print out the training summary
print(fitted.summary())
#create an out of sample forcast for the next 12 steps beyond the final data point in the training data set
trend_forecast = fitted.forecast(steps= 157200) If you run this and see an error, please upgrade to master. If you upgrade to master and see an error in your code, it is likely something with the dataset you are using. |
You might reset the index to be an integer index. We really only support integer, DateTime or Period indices. We might not check this enough. |
@bashtage Thank you for the reply! As suggested I also tried to reset index for the datafram and reran the code, it is showing the same error. This is how my dataframe looks like, for your reference: Kindly help! |
Do you see the bug on master? Which version of statsmodels are you using? |
The solution is to not set |
freq
only when useful in forecasting.
This helped to get rid of keyError, Thanks a ton! |
Improve handeling of index that has a freq but is nto a date index closes statsmodels#7565
Improve handeling of index that has a freq but is nto a date index closes statsmodels#7565
Describe the bug
I'm getting above TypeError while executing line 23 (forcast()) even though my frequency is not 'str'.
Code Sample, a copy-pastable example if possible
Error Message
Expected Output
I would like to get forcast values in trend_forcast
Output of
import statsmodels.api as sm; sm.show_versions()
[paste the output of
import statsmodels.api as sm; sm.show_versions()
here below this line]INSTALLED VERSIONS
Python: 3.7.10.final.0
OS: Linux 5.4.104+ #1 SMP Sat Jun 5 09:50:34 PDT 2021 x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
Statsmodels
Installed: 0.10.2 (/usr/local/lib/python3.7/dist-packages/statsmodels)
Required Dependencies
cython: 0.29.23 (/usr/local/lib/python3.7/dist-packages/Cython)
numpy: 1.19.5 (/usr/local/lib/python3.7/dist-packages/numpy)
scipy: 1.4.1 (/usr/local/lib/python3.7/dist-packages/scipy)
pandas: 1.1.5 (/usr/local/lib/python3.7/dist-packages/pandas)
dateutil: 2.8.1 (/usr/local/lib/python3.7/dist-packages/dateutil)
patsy: 0.5.1 (/usr/local/lib/python3.7/dist-packages/patsy)
Optional Dependencies
matplotlib: 3.2.2 (/usr/local/lib/python3.7/dist-packages/matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: 1.2.6 (/usr/local/lib/python3.7/dist-packages/cvxopt)
joblib: 1.0.1 (/usr/local/lib/python3.7/dist-packages/joblib)
Developer Tools
IPython: 5.5.0 (/usr/local/lib/python3.7/dist-packages/IPython)
jinja2: 2.11.3 (/usr/local/lib/python3.7/dist-packages/jinja2)
sphinx: 1.8.5 (/usr/local/lib/python3.7/dist-packages/sphinx)
pygments: 2.6.1 (/usr/local/lib/python3.7/dist-packages/pygments)
pytest: 3.6.4 (/usr/local/lib/python3.7/dist-packages)
virtualenv: Not installed
The text was updated successfully, but these errors were encountered: