code: def find_lowest_pq(df):
      """
      This is an auto-ARIMA function that iterates through parameters pdq and finds the best
      based on aan eval metric sent in as input.
  
      This finds the row and column numbers of the lowest or highest value in a dataframe. All it needs is numeric values.
      It will return the row and column together as a string, you will have to split it into two.
      It will also return the lowest value in the dataframe by default but you can change it to "max".
      """
      dicti = {}
      for ma in list(df):
          try:
              dicti[ma + " " + df[ma].idxmin()] = df[ma].sort_values()[
                  0
              ]
          except:
              pass
      lowest_bic = min(dicti.items(), key=operator.itemgetter(1))[1]
      lowest_pq = min(dicti.items(), key=operator.itemgetter(1))[0]
      ma_q = int(lowest_pq.split(" ")[0][2:])
      ar_p = int(lowest_pq.split(" ")[1][2:])
      print(
          "    Best AR order p = %d, MA order q = %d, Interim metric = %0.3f"
          % (ar_p, ma_q, lowest_bic)
      )
      return ar_p, ma_q, lowest_bic
  
file_path: Auto_TS/auto_ts/models/ar_based/param_finder.py
imports: import numpy
  import pandas
  import itertools
  import operator
  import copy
  import matplotlib.pyplot
  import seaborn
  from statsmodels.tsa.statespace.sarimax import SARIMAX
label_desc: Use image node_id 1 for calling a global function with example usage: find_lowest_pq(df) and returns: ar_p,  ma_q,  lowest_bic