title: Finding model with lowest AIC in python[return statement]
body: <p>I am trying to find model with lowest AIC. I am unable to make the function return model with lowest AIC. The code below demonstrates where I got stuck.</p>
  
  <pre><code>p = d = q = range(0,2)
  pdq = list(itertools.product(p,d,q))
  seasonal_pdq = [(x[0],x[1],x[2],12) for x in list(itertools.product(p,d,q))]
  parameters = []
  for param in pdq:
       for param_seasonal in seasonal_pdq:
         try:  
            model=sm.tsa.statespace.SARIMAX(y_hat,method='css',order=param,
             seasonal_order = param_seasonal,enforce_stationarity=False
              enforce_invertibility=False)  
  
               results = model.fit()
              print('ARIMA{}x{}12 - AIC: 
              {}'.format(param,param_seasonal,results.aic))
          except:
              continue
          aic = results.aic
          parameters.append([param,param_seasonal,aic])
  
  result_table = pd.DataFrame(parameters)
  result_table.columns = ['parameters','parameters_seasonal','aic']
  result_table = result_table.sort_values(by='aic',ascending = True).reset_index(drop = True)
  </code></pre>