code: def outlier_detect(data, col, threshold=1, method="IQR"):
      if method == "IQR":
          IQR = data[col].quantile(0.75) - data[col].quantile(0.25)
          Lower_fence = data[col].quantile(0.25) - (IQR * threshold)
          Upper_fence = data[col].quantile(0.75) + (IQR * threshold)
      if method == "STD":
          Upper_fence = data[col].mean() + threshold * data[col].std()
          Lower_fence = data[col].mean() - threshold * data[col].std()
      if method == "OWN":
          Upper_fence = data[col].mean() + threshold * data[col].std()
          Lower_fence = data[col].mean() - threshold * data[col].std()
      if method == "MAD":
          median = data[col].median()
          median_absolute_deviation = np.median(
              [np.abs(y - median) for y in data[col]]
          )
          modified_z_scores = pd.Series(
              [
                  0.6745 * (y - median) / median_absolute_deviation
                  for y in data[col]
              ]
          )
          outlier_index = np.abs(modified_z_scores) > threshold
          print(
              "Num of outlier detected:",
              outlier_index.value_counts()[1],
          )
          print(
              "Proportion of outlier detected",
              outlier_index.value_counts()[1] / len(outlier_index),
          )
          return outlier_index, (
              median_absolute_deviation,
              median_absolute_deviation,
          )
  
      para = (Upper_fence, Lower_fence)
      tmp = pd.concat(
          [data[col] > Upper_fence, data[col] < Lower_fence], axis=1
      )
      outlier_index = tmp.any(axis=1)
      print("Num of outlier detected:", outlier_index.value_counts()[1])
      print(
          "Proportion of outlier detected",
          outlier_index.value_counts()[1] / len(outlier_index),
      )
  
      return outlier_index, para
  
imports: import pandas
  import numpy
  import statsmodels.api
  from scipy import signal, integrate
  from pykalman import UnscentedKalmanFilter
  from tsaug import *
  from fbprophet import Prophet
  import pylab
  from seasonal.periodogram import periodogram
label_desc: Use image node_id 5 for calling a global function with example usage: outlier_detect(data, col, threshold, method) and returns: outlier_index,  para, outlier_index,  median_absolute_deviation,  median_absolute_deviation