def vectorize(func):
def wrapper(df, *args, **kwargs):<EOL><INDENT>if df.ndim == <NUM_LIT:1>:<EOL><INDENT>return func(df, *args, **kwargs)<EOL><DEDENT>elif df.ndim == <NUM_LIT:2>:<EOL><INDENT>return df.apply(func, *args, **kwargs)<EOL><DEDENT><DEDENT>return wrapper<EOL>
Decorator so that functions can be written to work on Series but
may still be called with DataFrames.