def ema(eqdata, **kwargs):
if len(eqdata.shape) > <NUM_LIT:1> and eqdata.shape[<NUM_LIT:1>] != <NUM_LIT:1>:<EOL><INDENT>_selection = kwargs.get('<STR_LIT>', '<STR_LIT>')<EOL>_eqdata = eqdata.loc[:, _selection]<EOL><DEDENT>else:<EOL><INDENT>_eqdata = eqdata<EOL><DEDENT>_span = kwargs.get('<STR_LIT>', <NUM_LIT:20>)<EOL>_col = kwargs.get('<STR_LIT>', '<STR_LIT>')<EOL>_emadf = pd.DataFrame(index=_eqdata.index, columns=[_col], dtype=np.float64)<EOL>_emadf.loc[:, _col] = _eqdata.ewm(span=_span, min_periods=<NUM_LIT:0>, adjust=True, ignore_na=False).mean().values.flatten()<EOL>return _emadf<EOL>
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`.