maxframe.liteframe.LiteFrame.to_parquet#

LiteFrame.to_parquet(path, engine='auto', compression='snappy', partition_cols=None, storage_options: dict = None, **kwargs)#

Write a LiteFrame to the binary parquet format, each chunk will be written to a Parquet file.

Simplified version for LiteFrame with no index semantics.

Parameters:
  • path (str or file-like object) – If path is a string with wildcard e.g. ‘/to/path/out-*.parquet’, to_parquet will try to write multiple files, for instance, chunk (0, 0) will write data into ‘/to/path/out-0.parquet’. If path is a string without wildcard and partition_cols is None, all data will be written into a single file. If path is a string with wildcard or partition_cols is not None, we will treat it as a directory.

  • engine ({'auto', 'pyarrow'}, default 'auto') – Parquet library to use. Only ‘pyarrow’ is currently supported.

  • compression ({'snappy', 'gzip', 'brotli', None}, default 'snappy') – Name of the compression to use. Use None for no compression.

  • partition_cols (list, optional, default None) – Column names by which to partition the dataset. Columns are partitioned in the order they are given. Must be None if path is not a string.

  • storage_options (dict, optional) – Extra options that make sense for a particular storage connection.

  • **kwargs – Additional arguments passed to the parquet library.

Returns:

Returns a stub LiteFrame for execution.

Return type:

None or LiteFrame

See also

read_parquet

Read a Parquet file into a LiteFrame.

to_csv

Write a LiteFrame to a CSV file.

Examples

>>> import maxframe.liteframe as mlf
>>> lf = mlf.LiteFrame(data={'col1': [1, 2], 'col2': [3, 4]})
>>> lf.to_parquet('*.parquet.gzip',
...               compression='gzip').execute()
>>> mlf.read_parquet('*.parquet.gzip').execute()
   col1  col2
0     1     3
1     2     4