# __init__.py
# main interface to pydataset module

from .datasets_handler import __print_item_docs, __read_csv, __datasets_desc


def data(item=None, show_doc=False):
    """loads a datasaet (from in-modules datasets) in a dataframe data structure.

    Args:
        item (str)      : name of the dataset to load.
        show_doc (bool) : to show the dataset's documentation.

    Examples:

    >>> iris = data('iris')
    loaded: iris <class 'pandas.core.frame.DataFrame'>

    >>> data('Titanic', show_doc=True)
        : returns the dataset's documentation.

    >>> data()
        : like help(), returns a dataframe [Item, Title]
        for a list of the available datasets.
    """

    if item:
        try:
            if show_doc:
                __print_item_docs(item)
                return

            df = __read_csv(item)
            return df
        except KeyError:
            raise Exception('Wrong dataset name! Try: data() to see available.')
    else:
        return __datasets_desc()


if __name__ == '__main__':
    # Numerical data
    rain = data('rain')
    print(rain)

# __init__.py
# main interface to pydataset module

from .datasets_handler import __print_item_docs, __read_csv, __datasets_desc


def data(item=None, show_doc=False):
    """loads a datasaet (from in-modules datasets) in a dataframe data structure.

    Args:
        item (str)      : name of the dataset to load.
        show_doc (bool) : to show the dataset's documentation.

    Examples:

    >>> iris = data('iris')


    >>> data('titanic', show_doc=True)
        : returns the dataset's documentation.

    >>> data()
        : like help(), returns a dataframe [Item, Title]
        for a list of the available datasets.
    """

    if item:
        try:
            if show_doc:
                __print_item_docs(item)
                return

            df = __read_csv(item)
            return df
        except KeyError:
            raise Exception('Wrong dataset name! Try: data() to see available.')
    else:
        return __datasets_desc()


if __name__ == '__main__':
    # Numerical data
    rain = data('rain')
    print(rain)

Remove unused log message.