pack_lists#
- pack_lists(df: DataFrame, name: str | None = None, *, validate: bool = True) NestedSeries[source]#
Make a series of arrow structures from a dataframe with nested arrays.
For the input dataframe with repeated indexes, make a pandas.Series, where each original column is replaced by a structure of lists. The dtype of the column is nested_pandas.NestedDtype with the corresponding pyarrow type. The index of the output series is the unique index of the input dataframe. The Series has .nest accessor, see
nested_pandas.series.accessor.NestSeriesAccessor()for details.For every row, all the nested array (aka pyarrow list) lengths must be the same.
- Parameters:
- Returns:
Output series, with unique indexes.
- Return type:
See also
nested_pandas.series.accessor.NestSeriesAccessorThe accessor for the output series.
nested_pandas.series.dtype.NestedDtypeThe dtype of the output series.
nested_pandas.series.packer.pack_flatPack a “flat” dataframe with repeated indexes.