NestedFrame.to_parquet

NestedFrame.to_parquet#

NestedFrame.to_parquet(path: str | Path | UPath, *, list_struct: bool = False, large_list: bool = False, **kwargs) → None[source]#

Creates parquet file(s) with the data of a NestedFrame, either as a single parquet file where each nested dataset is packed into its own column or as an individual parquet file for each layer.

Note that here we always opt to use the pyarrow engine for writing parquet files.

Parameters:
  • path (str) – The path to the parquet file

  • list_struct (bool) – Layout for the nested columns. If False (default), pack each nested column as a struct-of-lists (struct<field: list<...>, ...>). If True, pack it as a list-of-structs (list<struct<...>>).

  • large_list (bool) – If False (default), use regular list_ (int32 offsets). Set to True to use large_list (int64 offsets), which is required when the total number of nested elements across all rows exceeds 2**31 - 1.

  • kwargs (keyword arguments, optional) – Keyword arguments to pass to pyarrow.parquet.write_table

Return type:

None

Examples

>>> from nested_pandas.datasets import generate_data
>>> nf = generate_data(5,5, seed=1)
>>> nf.to_parquet("nestedframe.parquet")