diff --git a/README.md b/README.md index 769565b..b8cfe06 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ from pydataset import data ```python titanic = data('titanic') ``` -- To display the documentation of a dataset: +- To get the documentation of a dataset instead: ```python -data('titanic', show_doc=True) +data('titanic', get_doc=True) ``` - To see the available datasets: ```python @@ -59,6 +59,13 @@ For example, ### Changelog +**Forked version** + +- changed show_doc parameter to get_doc +- get_doc now returns the documentation as a string +- added new datasets +- removed unnecessary csv files from resources + **0.2.0** - Add search dataset by name similarity. diff --git a/pydataset/__init__.py b/pydataset/__init__.py index 6ef3216..bb17261 100644 --- a/pydataset/__init__.py +++ b/pydataset/__init__.py @@ -1,23 +1,23 @@ # __init__.py # main interface to pydataset module -from .datasets_handler import __print_item_docs, __read_csv, __datasets_desc +from .datasets_handler import __print_item_docs, __read_csv, __datasets_desc, __get_item_docs from .support import find_similar -def data(item=None, show_doc=False): +def data(item=None, get_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. + get_doc (bool) : to get the dataset's documentation instead. Examples: >>> iris = data('iris') - >>> data('titanic', show_doc=True) + >>> data('titanic', get_doc=True) : returns the dataset's documentation. >>> data() @@ -27,9 +27,9 @@ def data(item=None, show_doc=False): if item: try: - if show_doc: - __print_item_docs(item) - return + if get_doc: + # __print_item_docs(item) + return __get_item_docs(item) df = __read_csv(item) return df diff --git a/pydataset/datasets_handler.py b/pydataset/datasets_handler.py index 038f6e9..660259d 100644 --- a/pydataset/datasets_handler.py +++ b/pydataset/datasets_handler.py @@ -55,10 +55,14 @@ def __get_doc_path(item): return docs[item] -def __print_item_docs(item): +def __get_item_docs(item): path = __get_doc_path(item) doc = __read_docs(path) # html format - txt = __filter_doc(doc) # edit R related txt + return __filter_doc(doc) # edit R related txt + + +def __print_item_docs(item): + txt = __get_item_docs(item) print(txt) diff --git a/pydataset/resources.tar.gz b/pydataset/resources.tar.gz index 1c410d7..ba62e54 100644 Binary files a/pydataset/resources.tar.gz and b/pydataset/resources.tar.gz differ