Skip to main content
`Ctrl`+`K`

# pandas.Series.list.flatten

Series.list.flatten()

  Flatten list values.

  Each list element is expanded into separate rows, preserving the original index. The resulting Series may have a longer length than the original if lists contain more than one element.

  Returns:
    pandas.Series

      The data from all lists in the series flattened.

  See also

  `ListAccessor.__getitem__`

    Index or slice values in the Series.

  Examples

      >>> import pyarrow as pa
      >>> s = pd.Series(
      ...     [
      ...         [1, 2, 3],
      ...         [3],
      ...     ],
      ...     dtype=pd.ArrowDtype(pa.list_(pa.int64())),
      ... )
      >>> s.list.flatten()
      0    1
      0    2
      0    3
      1    3
      dtype: int64[pyarrow]