code: def adx(f, p=14):
      r"""Calculate the Average Directional Index (ADX).
  
      Parameters
      ----------
      f : pandas.DataFrame
          Dataframe with all columns required for calculation. If you
          are applying ADX through ``vapply``, then these columns are
          calculated automatically.
      p : int
          The period over which to calculate the ADX.
  
      Returns
      -------
      new_column : pandas.Series (float)
          The array containing the new feature.
  
      References
      ----------
      The Average Directional Movement Index (ADX) was invented by J. Welles
      Wilder in 1978 [WIKI_ADX]_.  Its value reflects the strength of trend in any
      given instrument.
  
      .. [WIKI_ADX] https://en.wikipedia.org/wiki/Average_directional_movement_index
  
      """
      c1 = "diplus"
      vexec(f, c1)
      c2 = "diminus"
      vexec(f, c2)
      # calculations
      dip = f[c1]
      dim = f[c2]
      didiff = abs(dip - dim)
      disum = dip + dim
      new_column = 100 * didiff.ewm(span=p).mean() / disum
      return new_column
  
imports: from alphapy.calendrical import biz_day_month
  from alphapy.calendrical import biz_day_week
  from alphapy.globals import NULLTEXT
  from alphapy.globals import BSEP, PSEP, USEP
  from alphapy.variables import vexec
  import itertools
  import logging
  import math
  import numpy
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: adx(f, p) and returns: new_column