pandas.DataFrame.to_parquet

pandas 3.1.1 · DataFrame · method

Write a DataFrame in the Parquet columnar format. Set compression or partition_cols where needed.

Call syntax

DataFrame.to_parquet(…) Full signature
DataFrame.to_parquet(
    path=None,
    *,
    engine=…,
    compression='snappy',
    index=None,
    partition_cols=None,
    storage_options=None,
    filesystem=None,
    **kwargs,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
path Optional
Positional or keyword
Default None
str, path object, file-like object, or None

Supply a file path or file-like object where supported.

engine Optional
Keyword only
{'auto', 'pyarrow', 'fastparquet'}

Choose the implementation that performs the operation.

compression Optional
Keyword only
Default 'snappy'
str or None

Choose whether and how to compress or decompress data.

index Optional
Keyword only
Default None
bool

Supply row labels or control how existing row labels are used.

partition_cols Optional
Keyword only
Default None
list
storage_options Optional
Keyword only
Default None
dict

Pass storage-backend options such as connection settings or HTTP headers.

filesystem Optional
Keyword only
Default None
fsspec or pyarrow filesystem

Provide a filesystem object for accessing the dataset.

**kwargs Optional
Additional keyword arguments

Returns

bytes if no path argument is provided else None