code: def ema(eqdata, **kwargs):
      
      if len(eqdata.shape) > 1 and eqdata.shape[1] != 1:
          _selection = kwargs.get('selection', 'Adj Close')
          _eqdata = eqdata.loc[:, _selection]
      else:
          _eqdata = eqdata
      _span = kwargs.get('span', 20)
      _col = kwargs.get('outputcol', 'EMA')
      _emadf = pd.DataFrame(index=_eqdata.index, columns=[_col], dtype=np.float64)
      _emadf.loc[:, _col] = _eqdata.ewm(span=_span, min_periods=0, adjust=True, ignore_na=False).mean().values.flatten()
      return _emadf
docs: Exponential moving average with the given span.
  
      Parameters
      ----------
      eqdata : DataFrame
          Must have exactly 1 column on which to calculate EMA
      span : int, optional
          Span for exponential moving average. Cf. `pandas.stats.moments.ewma 
          <http://pandas.pydata.org/pandas-docs/stable/generated/pandas.stats.moments.ewma.html>`_ and
          `additional Pandas documentation 
          <http://pandas.pydata.org/pandas-docs/stable/computation.html#exponentially-weighted-moment-functions>`_.
      outputcol : str, optional
          Column to use for output. Defaults to 'EMA'.
      selection : str, optional
          Column of eqdata on which to calculate ema. If
          `eqdata` has only 1 column, `selection` is ignored,
          and ema is calculated on that column. Defaults
          to 'Adj Close'.
  
      Returns
      ---------
      emadf : DataFrame
          Exponential moving average using the given `span`.