0

My Dataframe(train) look like this

            total_mtrs   total_mtrs_2
trx_date        
2013-07-01  3449701.0   -1.362983
2013-08-01  3172872.0   -1.585093
2013-09-01  3137336.0   -1.613605
2013-10-01  3108550.0   -1.636701
2013-11-01  2981503.0   -1.738636
... ... ...
2020-06-01  4393613.0   -0.605648
2020-07-01  5173863.0   0.020375
2020-08-01  5629610.0   0.386038
2020-09-01  6417227.0   1.017972
2020-10-01  6424951.0   1.024169

I can perform every operation it cant show any error and compile successfully but then I train Time series model with this

arma_mod20 = ARIMA(train, order=(0,1,0)).fit()
print(arma_mod20.params)

It can shows an error.

ValueError: SARIMAX models require univariate `endog`. Got shape (88, 2).

I search on stack overflow and google as well I am unable to find any solution. I use ARIMA model but it throws an error of SARIMAX model.

Mehmaam
  • 573
  • 7
  • 22
  • I think what the error says is that the endogenous variable should have a single dimension, i.e. single column. – NotAName Sep 20 '22 at 05:10

2 Answers2

0

try using a specific column name like in your case it is,

arma_mod20 = ARIMA(train.total_mtrs, order=(0,1,0)).fit()
Jimson James
  • 2,937
  • 6
  • 43
  • 78
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 21 '22 at 17:40
0

What worked for me is to add a specific Column name in your Dataframe. This error happened to me after changing the old lib statsmodels.tsa.arima_model to statsmodels.tsa.arima.model (note the change in model name with underscore).

For your use case try this:

rma_mod20 = ARIMA(train.total_mtrs, order=(0,1,0)).fit()

OR

rma_mod20 = ARIMA(train.total_mtrs_2, order=(0,1,0)).fit()
Azhar Khan
  • 3,829
  • 11
  • 26
  • 32
Janik
  • 1
  • 1