pandas.api.extensions.ExtensionArray._explode#

ExtensionArray._explode()[source]#

Transform each element of list-like to a row.

For arrays that do not contain list-like elements the default implementation of this method just returns a copy and an array of ones (unchanged index).

Returns:
ExtensionArray

Array with the exploded values.

np.ndarray[uint64]

The original lengths of each list-like for determining the resulting index.

See also

Series.explode

The method on the Series object that this extension array method is meant to support.

Examples

>>> import pyarrow as pa
>>> a = pd.array([[1, 2, 3], [4], [5, 6]],
...              dtype=pd.ArrowDtype(pa.list_(pa.int64())))
>>> a._explode()
(<ArrowExtensionArray>
[1, 2, 3, 4, 5, 6]
Length: 6, dtype: int64[pyarrow], array([3, 1, 2], dtype=int32))