code: def return_frequency_components(
      data: pd.Series, type: str = "periodogram"
  ) -> Tuple[np.ndarray, np.ndarray]:
      """Return the Spectral Density using the specified method.
      NOTE: Frequency = 0 is discarded
  
      Parameters
      ----------
      data : pd.Series
          Data for which the frequency components must be obtained
      type : str, optional
          Type of method to use to get the frequency components, by default "periodogram"
          Allowed methods are: "periodogram", "fft"
  
      Returns
      -------
      Tuple[np.ndarray, np.ndarray]
          Frequency, Amplitude
      """
  
      if type == "periodogram":
          freq, ampl = _return_periodogram(data=data)
      elif type == "fft":
          freq, ampl = _return_fft(data=data)
      else:
          raise ValueError(
              f"Getting frequency component using type: {type} is not supported."
          )
  
      x = freq[1:]
      y = ampl[1:]
  
      return x, y
  
imports: from math import ceil
  from typing import Any, Dict, List, Optional, Tuple, Union
  import matplotlib
  import matplotlib.pyplot
  import numpy
  import pandas
  import plotly.express
  import plotly.graph_objects
  import plotly.io
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from plotly.subplots import make_subplots
  from scipy.fft import fft, fftfreq
  from scipy.signal import periodogram
  from statsmodels.graphics.gofplots import qqplot
  from statsmodels.tsa.seasonal import STL, seasonal_decompose
  from statsmodels.tsa.stattools import acf, ccf, pacf
  from pycaret.internal.logging import get_logger
  from pycaret.utils.generic import _resolve_dict_keys
  from pycaret.utils.time_series import TSAllowedPlotDataTypes
label_desc: Use image node_id 8 for calling a global function with example usage: return_frequency_components(data, type) and returns: x,  y