code: def adfuller_stationarity(
      data: pd.Series, confidence_level: float = 0.05
  ) -> TestResult:
      """Augmented Dickey-Fuller unit root test, can be used to test for a unit root in a univariate
      process in the presence of serial correlation.
  
      Args:
          data (pd.Series): Time series.
          confidence_level (float): Confidence level for rejecting the null hypothesis.
  
      Returns:
          TestResult: test name, p-value, null hypothesis, reject?, confidence level and details.
  
      See Also:
          https://www.statsmodels.org/stable/generated/statsmodels.tsa.stattools.adfuller.html
      """
      ser_clean = data
      if np.isnan(data).any():
          ser_clean = data.dropna()
          warnings.warn("Found and removed N/A values.", UserWarning)
  
      if len(ser_clean) < 6:
          warnings.warn("Sample size is too short", UserWarning)
          test_statistic, p_value, n_lags, n_obs, crit = (
              np.nan,
              np.nan,
              None,
              None,
              None,
          )
      else:
          test_statistic, p_value, n_lags, n_obs, crit, *_ = adfuller(
              ser_clean, autolag="AIC"
          )
  
      outcome_specifics = {
          "test_statistic": test_statistic,
          "n_lags": n_lags,
          "n_obs": n_obs,
          "critical_values": crit,
      }
      reject_h0 = bool(p_value < confidence_level)
      result = TestResult(
          test="Augmented Dickey-Fuller",
          p_value=float(p_value),
          confidence_level=confidence_level,
          null_hypothesis="Data has unit root",
          reject_null_hypothesis=reject_h0,
          details=outcome_specifics,
      )
  
      return result
  
file_path: tslumen/tslumen/profile/stat_tests.py
imports: from typing import Dict, Any, Optional
  from dataclasses import dataclass
  import math
  import warnings
  import numpy
  import pandas
  import scipy
  import statsmodels.stats.api
  from statsmodels.tsa.tsatools import freq_to_period
  from statsmodels.tsa.stattools import acf, adfuller, kpss
  from tslumen.profile.base import ProfilingFunction, _DCDict
  from tslumen.misc import repr_html
label_desc: Use image node_id 5 for calling a global function with example usage: adfuller_stationarity(data, confidence_level) and returns: result