def register_dataframe_method(method):
def inner(*args, **kwargs):<EOL><INDENT>class AccessorMethod(object):<EOL><INDENT>def __init__(self, pandas_obj):<EOL><INDENT>self._obj = pandas_obj<EOL><DEDENT>@wraps(method)<EOL>def __call__(self, *args, **kwargs):<EOL><INDENT>return method(self._obj, *args, **kwargs)<EOL><DEDENT><DEDENT>register_dataframe_accessor(method.__name__)(AccessorMethod)<EOL>return method<EOL><DEDENT>return inner()<EOL>
Register a function as a method attached to the Pandas DataFrame.

    Example
    -------

    .. code-block:: python

        @register_dataframe_method
        def print_column(df, col):
            '''Print the dataframe column given'''
            print(df[col])