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 the pickle file is saved.

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

  • prt_kwargs (dict | None) – [Optional] Additional parameters for pyhelpers.store.ldr._check_loading_path(); defaults to None.

  • kwargs – [Optional] Additional parameters for the function pickle.load().

Returns:

Data retrieved from the specified path path_to_file.

Return type:

Any

Note

Example data can be referred to the function save_pickle().

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