bigframes.pandas.api.typing.StructAccessor.explode#

StructAccessor.explode() DataFrame[source]#

Extract all child fields of a struct as a DataFrame.

Examples:

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

Extract all child fields.

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

[3 rows x 2 columns]
Returns:

The data corresponding to all child fields.

Return type:

DataFrame