code: def partial_autocorrelation(x, param=[{"lag": 1}]):
      # Check the difference between demanded lags by param and possible lags to calculate (depends on len(x))
      max_demanded_lag = max([lag["lag"] for lag in param])
      n = len(x)
  
      # Check if list is too short to make calculations
      if n <= 1:
          pacf_coeffs = [np.nan] * (max_demanded_lag + 1)
      else:
          if n <= max_demanded_lag:
              max_lag = n - 1
          else:
              max_lag = max_demanded_lag
          pacf_coeffs = list(pacf(x, method="ld", nlags=max_lag))
          pacf_coeffs = pacf_coeffs + [np.nan] * max(
              0, (max_demanded_lag - max_lag)
          )
  
      return [
          ("lag_{}".format(lag["lag"]), pacf_coeffs[lag["lag"]])
          for lag in param
      ]
  
imports: import pandas
  import numpy
  from statsmodels.tsa.stattools import acf, adfuller, pacf
  import itertools
  from statsmodels.tsa.ar_model import AR
  from scipy.signal import cwt, find_peaks_cwt, ricker, welch
  from scipy.stats import linregress
  import scipy.stats
  from scipy.stats import kurtosis
  from scipy.stats import skew
  import numpy
  from scipy import signal, integrate
  from scipy.interpolate import interp1d
  import math
  from statsmodels.tools.sm_exceptions import MissingDataError
  from numpy.linalg import LinAlgError
label_desc: Use image node_id 11 for calling a global function with example usage: partial_autocorrelation(x, param) and returns: unknown