def volatility(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>_window = kwargs.get('<STR_LIT>', <NUM_LIT:20>)<EOL>_colname = kwargs.get('<STR_LIT>', '<STR_LIT>')<EOL>_risk = pd.DataFrame(index=_eqdata.index, columns=[_colname], dtype=np.float64)<EOL>_risk.loc[:, _colname] = _eqdata.rolling(center=False, window=_window).std().values.flatten()<EOL>return _risk<EOL>
Volatility (standard deviation) over the given window

Parameters
----------
eqdata : DataFrame
window : int, optional
    Lookback period. Defaults to 20.
outputcol : str, optional
    Name of column to be used in returned dataframe. Defaults to 'Risk'.
selection : str, optional
    Column of eqdata on which to calculate volatility. If
    `eqdata` has only 1 column, `selection` is ignored,
    and volatility is calculated on that column. Defaults
    to 'Adj Close'.

Returns
---------
risk : DataFrame
    Moving volatility with the given lookback.