Skip to main content
`Ctrl`+`K`

# pandas.Series.struct.explode

Series.struct.explode()

  Extract all child fields of a struct as a DataFrame.

  Each child field of the struct becomes a column in the resulting DataFrame, with column names matching the struct field names.

  Returns:
    pandas.DataFrame

      The data corresponding to all child fields.

  See also

  `Series.struct.field`

    Return a single child field as a Series.

  Examples

      >>> import pyarrow as pa
      >>> s = pd.Series(
      ...     [
      ...         {"version": 1, "project": "pandas"},
      ...         {"version": 2, "project": "pandas"},
      ...         {"version": 1, "project": "numpy"},
      ...     ],
      ...     dtype=pd.ArrowDtype(
      ...         pa.struct([("version", pa.int64()), ("project", pa.string())])
      ...     ),
      ... )

      >>> s.struct.explode()
         version project
      0        1  pandas
      1        2  pandas
      2        1   numpy