Schema.write_parquet#

classmethod Schema.write_parquet(
df: DataFrame[Self],
/,
file: str | Path | IO[bytes],
**kwargs: Any,
) None[source]#

Write a typed data frame with this schema to a parquet file.

This method automatically adds a serialization of this schema to the parquet file as metadata. This metadata can be leveraged by read_parquet() and scan_parquet() for more efficient reading, or by external tools.

Parameters:
  • df – The data frame to write to the parquet file.

  • file – The file path or writable file-like object to which to write the parquet file. This should be a path to a directory if writing a partitioned dataset.

  • kwargs – Additional keyword arguments passed directly to polars.write_parquet(). metadata may only be provided if it is a dictionary.

Attention

Be aware that this method suffers from the same limitations as serialize().