save_feather

pyhelpers.store.save_feather(data, path_to_file, index=False, verbose=False, **kwargs)[source]

Save a dataframe to a Feather file.

Parameters:
  • data (pandas.DataFrame) – The dataframe to be saved as a Feather-formatted file.

  • path_to_file (str | os.PathLike) – The path where the Feather file will be saved.

  • index (bool) – Whether to include the index as a column; defaults to False.

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

  • kwargs – [Optional] Additional parameters for the method 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