DataFrame.to_parquet(path, *args, **kwargs)#

Write a DataFrame to the parquet format.

pathstr or list of str

File path or Root Directory path. Will be used as Root Directory path while writing a partitioned dataset. Use list of str with partition_offsets to write parts of the dataframe to different files.

compression{‘snappy’, None}, default ‘snappy’

Name of the compression to use. Use None for no compression.

indexbool, default None

If True, include the dataframe’s index(es) in the file output. If False, they will not be written to the file. If None, the engine’s default behavior will be used. However, instead of being saved as values, the RangeIndex will be stored as a range in the metadata so it doesn’t require much space and is faster. Other indexes will be included as columns in the file output.

partition_colslist, optional, default None

Column names by which to partition the dataset Columns are partitioned in the order they are given

partition_file_namestr, optional, default None

File name to use for partitioned datasets. Different partitions will be written to different directories, but all files will have this name. If nothing is specified, a random uuid4 hex string will be used for each file.

partition_offsetslist, optional, default None

Offsets to partition the dataframe by. Should be used when path is list of str. Should be a list of integers of size len(path) + 1

statistics{‘ROWGROUP’, ‘PAGE’, ‘NONE’}, default ‘ROWGROUP’

Level at which column statistics should be included in file.

metadata_file_pathstr, optional, default None

If specified, this function will return a binary blob containing the footer metadata of the written parquet file. The returned blob will have the chunk.file_path field set to the metadata_file_path for each chunk. When using with partition_offsets, should be same size as len(path)

int96_timestampsbool, default False

If True, write timestamps in int96 format. This will convert timestamps from timestamp[ns], timestamp[ms], timestamp[s], and timestamp[us] to the int96 format, which is the number of Julian days and the number of nanoseconds since midnight. If False, timestamps will not be altered.

row_group_size_bytes: integer or None, default None

Maximum size of each stripe of the output. If None, 134217728 (128MB) will be used.

row_group_size_rows: integer or None, default None

Maximum number of rows of each stripe of the output. If None, 1000000 will be used.


To request metadata binary blob when using with partition_cols, Pass return_metadata=True instead of specifying metadata_file_path