save_feather

pyhelpers.store.save_feather(feather_data, path_to_feather, index=False, verbose=False, **kwargs)

Save a dataframe to a Feather file.

Parameters
  • feather_data (pandas.DataFrame) – a dataframe to be saved as a feather-formatted file

  • path_to_feather (str or os.PathLike[str]) – path where a feather file is saved

  • index (bool) – whether to include the index as a column, defaults to False

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

  • kwargs – [optional] parameters of pandas.DataFrame.to_feather

Examples:

>>> from pyhelpers.store import save_feather
>>> from pyhelpers.dirs import cd
>>> from pyhelpers._cache import example_dataframe

>>> feather_dat = example_dataframe()  # Get an example dataframe
>>> feather_dat
            Longitude   Latitude
City
London      -0.127647  51.507322
Birmingham  -1.902691  52.479699
Manchester  -2.245115  53.479489
Leeds       -1.543794  53.797418

>>> feather_pathname = cd("tests\data", "dat.feather")

>>> save_feather(feather_dat, feather_pathname, verbose=True)
Saving "dat.feather" to "tests\data\" ... Done.

>>> save_feather(feather_dat, feather_pathname, index=True, verbose=True)
Updating "dat.feather" at "tests\data\" ... Done.

See also