Nabih Bawazir
Nabih Bawazir

Reputation: 7265

How to for - loop for multiple pmdarima univarite model from dataframe using python

Note: I did more complex question here, since it seems to complex on one question, I decide to split into smaller one

Here's my dataset

name    AEON Mall Jakarta Garden City   Blok M Plaza      Buaran Plaza  Central Park Mall   Cibubur Junction
date_id                     
20220501                       6569.0          751.0            1719.0             4215.0   1125.0
20220502                       6028.0          569.0            1855.0             4151.0   439.0

Here's my curent code

import pmdarima.arima as pm

model_1 = pm.auto_arima(df['AEON Mall Jakarta Garden City'], 
                        m=7, seasonal=True,
                      start_p=0, start_q=0, max_order=4, test='adf',error_action='ignore',  
                           suppress_warnings=True,
                      stepwise=True, trace=True)

model_2 = pm.auto_arima(df['Blok M Plaza'], 
                        m=7, seasonal=True,
                      start_p=0, start_q=0, max_order=4, test='adf',error_action='ignore',  
                           suppress_warnings=True,
                      stepwise=True, trace=True)

model_3 = pm.auto_arima(df['Buaran Plaza'], 
                        m=7, seasonal=True,
                      start_p=0, start_q=0, max_order=4, test='adf',error_action='ignore',  
                           suppress_warnings=True,
                      stepwise=True, trace=True)
...

Since te actiual dataframe is have 55 columns, the code is prone to mistake, how to do looping in this case

Expected output avaliable here

Upvotes: 0

Views: 85

Answers (0)

Related Questions