pack#
- pack(obj, name: str | None = None, *, index=None, on: None | str | list[str] = None, dtype: NestedDtype | ArrowDtype | DataType | None = None) NestedSeries[source]#
Pack a “flat” dataframe or a sequence of dataframes into a “nested” series.
- Parameters:
obj (pd.DataFrame or Sequence of) – Input dataframe, with repeated indexes, or a sequence of dataframes or missed values.
name (str, optional) – Name of the output series.
index (convertable to pd.Index, optional) – Index of the output series. If obj is a pd.DataFrame, it is always nested by the original index, and this value is used to override the index after the nesting.
on (str or list of str, optional) – Column name(s) to join on. If None, the index is used.
dtype (dtype or None) – NestedDtype of the output series, or other type to derive from. If None, the dtype is inferred from the first non-missing dataframe.
- Returns:
Output series.
- Return type: