pyarrow.dense_union#

pyarrow.dense_union(child_fields, type_codes=None)#

Create DenseUnionType from child fields.

A dense union is a nested type where each logical value is taken from a single child, at a specific offset. A buffer of 8-bit type ids indicates which child a given logical value is to be taken from, and a buffer of 32-bit offsets indicates at which physical position in the given child array the logical value is to be taken from.

Unlike a sparse union, a dense union allows encoding only the child array values which are actually referred to by the union array. This is counterbalanced by the additional footprint of the offsets buffer, and the additional indirection cost when looking up values.

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:
typeDenseUnionType