load_pickle

pyhelpers.store.load_pickle(path_to_file, verbose=False, prt_kwargs=None, **kwargs)[source]

Load data from a Pickle file.

Parameters:
  • path_to_file (str | os.PathLike) – Path where a pickle file is saved.

  • verbose (bool | int) – Whether to print relevant information in console; defaults to False.

  • prt_kwargs (dict | None) – [Optional] parameters of pyhelpers.store.ldr.__check_loading_path(); defaults to None.

  • kwargs – [Optional] parameters of pickle.load.

Returns:

Data retrieved from the specified path path_to_file.

Return type:

Any

Note

Examples:

>>> from pyhelpers.store import load_pickle
>>> from pyhelpers.dirs import cd

>>> pickle_pathname = cd("tests\data", "dat.pickle")
>>> pickle_dat = load_pickle(pickle_pathname, verbose=True)
Loading "tests\data\dat.pickle" ... Done.
>>> pickle_dat
            Longitude   Latitude
City
London      -0.127647  51.507322
Birmingham  -1.902691  52.479699
Manchester  -2.245115  53.479489
Leeds       -1.543794  53.797418