def expand(fn, col, inputtype=pd.DataFrame):
if inputtype == pd.DataFrame:<EOL><INDENT>if isinstance(col, int):<EOL><INDENT>def _wrapper(*args, **kwargs):<EOL><INDENT>return fn(args[<NUM_LIT:0>].iloc[:, col], *args[<NUM_LIT:1>:], **kwargs)<EOL><DEDENT>return _wrapper<EOL><DEDENT>def _wrapper(*args, **kwargs):<EOL><INDENT>return fn(args[<NUM_LIT:0>].loc[:, col], *args[<NUM_LIT:1>:], **kwargs)<EOL><DEDENT>return _wrapper<EOL><DEDENT>elif inputtype == np.ndarray:<EOL><INDENT>def _wrapper(*args, **kwargs):<EOL><INDENT>return fn(args[<NUM_LIT:0>][:, col], *args[<NUM_LIT:1>:], **kwargs)<EOL><DEDENT>return _wrapper<EOL><DEDENT>raise TypeError("<STR_LIT>")<EOL>
Wrap a function applying to a single column to make a function
applying to a multi-dimensional dataframe or ndarray

Parameters
----------
fn : function
    Function that applies to a series or vector.

col : str or int
    Index of column to which to apply `fn`.

inputtype : class or type
    Type of input to be expected by the wrapped function.
    Normally pd.DataFrame or np.ndarray. Defaults to pd.DataFrame.

Returns
----------
wrapped : function
    Function that takes an input of type `inputtype` and applies
    `fn` to the specified `col`.