Return values expressed as ratios to the average over some number
    of prior sessions.

    Parameters
    ----------
    eqdata : DataFrame
        Must contain a column with name matching `selection`, or, if
        `selection` is not specified, a column named 'Volume'
    window : int
        Interval over which to calculate the average. Normally 252 (1 year)
    selection : str, optional
        Column to select for calculating ratio. Defaults to 'Volume'
    skipstartrows : int, optional
        Rows to skip at beginning in addition to the `window` rows
        that must be skipped to get the baseline volume. Defaults to 0.
    skipendrows : int, optional
        Rows to skip at end. Defaults to 0.
    outputcol : str, optional
        Name of column in output dataframe. Defaults to 'Ratio to Ave'

    Returns
    ---------
    out : DataFrame

def ratio_to_ave(window, eqdata, **kwargs):
    """
    Return values expressed as ratios to the average over some number
    of prior sessions.

    Parameters
    ----------
    eqdata : DataFrame
        Must contain a column with name matching `selection`, or, if
        `selection` is not specified, a column named 'Volume'
    window : int
        Interval over which to calculate the average. Normally 252 (1 year)
    selection : str, optional
        Column to select for calculating ratio. Defaults to 'Volume'
    skipstartrows : int, optional
        Rows to skip at beginning in addition to the `window` rows
        that must be skipped to get the baseline volume. Defaults to 0.
    skipendrows : int, optional
        Rows to skip at end. Defaults to 0.
    outputcol : str, optional
        Name of column in output dataframe. Defaults to 'Ratio to Ave'

    Returns
    ---------
    out : DataFrame
    """
    _selection = kwargs.get('selection', 'Volume')
    _skipstartrows = kwargs.get('skipstartrows', 0)
    _skipendrows = kwargs.get('skipendrows', 0)
    _outputcol = kwargs.get('outputcol', 'Ratio to Ave')
    _size = len(eqdata.index)
    _eqdata = eqdata.loc[:, _selection]

    _sma = _eqdata.iloc[:-1 - _skipendrows].rolling(window=window, center=False).mean().values
    _outdata = _eqdata.values[window + _skipstartrows:_size - _skipendrows] /\
            _sma[window + _skipstartrows - 1:]
    _index = eqdata.index[window + _skipstartrows:_size - _skipendrows]
    return pd.DataFrame(_outdata, index=_index, columns=[_outputcol], dtype=np.float64)