krank.fetch_table#

krank.fetch_table(dataset, table, version=None, load=True, **kwargs)#

Fetch a manually-extracted table as a pandas.DataFrame.

Calling this function will always retrieve/download the file from its remote source if it has not already been retrieved (via pooch.retrieve()).

Refer to the online krank.tables documentation for more details about the module and available tables.

Note

Custom loading

The default krank loader is minimal. To apply custom loading, either (1) set load=False to return the local filepath and load the file in subsequent steps, or (2) pass a callable function to load and it will be used to load the file instead of the krank default loader.

See also

This is a top-level wrapper around dataset-specific functions in the krank.tables module. For example, calling krank.fetch_table("barrett2020", "table1") is identical to calling krank.tables.fetch_barrett2020("table1").

Parameters#

datasetstr

Name of dataset (i.e., publication). Refer to the tables documentation for a list of all available datasets.

tablestr

Name of table from within the dataset. Refer to the tables documentation for a list of all available tables within each dataset.

versionstr or None

Name of version. If None (default), fetches the latest version. Refer to the tables documentation for a list of all available versions within each dataset.

loadbool or callable

If False (default), fetch the file and return the local filepath. If True, fetch the file and load it as a pandas.DataFrame. If a callable, fetch the file an load it with the custom callable.

**kwargsdict, optional

Additional keyword arguments are passed to pooch.retrieve().

Returns#

str or DataFrame

Path of retrieved file if load is False, or pandas.DataFrame if load is True.