load_pickle

pyhelpers.store.load_pickle(path_to_pickle, verbose=False, **kwargs)

Load data from a Pickle file.

Parameters
  • path_to_pickle (str or os.PathLike[str]) – path where a pickle file is saved

  • verbose (bool or int) – whether to print relevant information in console, defaults to False

  • kwargs – [optional] parameters of pickle.load

Returns

data retrieved from the specified path path_to_pickle

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