diive.save_parquet

diive.save_parquet(filename, data, outpath=None, enforce_diive_format=False, timestamp_name=None)[source]

Save pandas Series or DataFrame as Parquet file.

Parquet is a columnar format designed for efficient storage and retrieval. Index and column names are preserved.

Parameters:
  • filename (str) – str Name of output file (without extension; .parquet is added automatically).

  • data (DataFrame) – pandas.Series or pandas.DataFrame Data to save. Series is converted to single-column DataFrame. Index name is preserved (e.g., ‘TIMESTAMP_END’, ‘TIMESTAMP_START’, ‘TIMESTAMP_MIDDLE’).

  • outpath (str) – str or Path, optional Directory path for output file. Default None: saves to current working directory.

  • enforce_diive_format (bool) – bool, optional (default False) If True, coerce the data to the diive parquet format before saving (see to_diive_format()): one header row (flattened columns) and a validly-named timestamp index. Raises ValueError if the index name is not valid and timestamp_name is not given.

  • timestamp_name (str) – str, optional Timestamp index name to set when enforce_diive_format is True. One of ‘TIMESTAMP_END’, ‘TIMESTAMP_MIDDLE’, ‘TIMESTAMP_START’.

Return type:

str

Returns:

str

Full filepath to saved Parquet file.

Notes

The index name is preserved in the Parquet file, the index frequency is not. load_parquet() detects the frequency again when it sanitizes the timestamp. When reloading with load_parquet(), use output_middle_timestamp to convert timestamp representation if needed.

Example

See examples/io/io_load_save_parquet.py