pandas.Series.struct.explode#
- Series.struct.explode()[source]#
Extract all child fields of a struct as a DataFrame.
- 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