pyarrow.sparse_union#

pyarrow.sparse_union(child_fields, type_codes=None)#

Create SparseUnionType from child fields.

A sparse union is a nested type where each logical value is taken from a single child. A buffer of 8-bit type ids indicates which child a given logical value is to be taken from.

In a sparse union, each child array should have the same length as the union array, regardless of the actual number of union values that refer to it.

Parameters:
child_fieldssequence of Field values

Each field must have a UTF8-encoded name, and these field names are part of the type metadata.

type_codeslist of integers, default None
Returns:
typeSparseUnionType