Search code examples
pythonpandasmatplotlibstatsmodelsarima

Read data frame from get_prediction function of statsmodels library


I am creating forecast model using arima here i have use statsmodels

Get forecast steps ahead in future

pred_uc = results.get_prediction(start='2001-05-01',end='2002-05-01')
print(pred_uc)

When I print this i get its in objects can it be converted into readable format in array or data frame

<statsmodels.tsa.statespace.mlemodel.PredictionResultsWrapper object at 0x00000000156E71D0>

Here it looks like data is stored in memory location and since i am noob in python i need a bit of help here...

code from

Source code of statsmodels library


Solution

  • Based on this Google search result (Japanese), try

    pred_uc.predicted_mean
    

    You can also get a DataFrame of 95% confidence intervals with

    pred_uc_ci = pred_uc.conf_int(alpha=0.05)