pyarrow.unify_schemas#

pyarrow.unify_schemas(schemas, *, promote_options='default')#

Unify schemas by merging fields by name.

The resulting schema will contain the union of fields from all schemas. Fields with the same name will be merged. Note that two fields with different types will fail merging by default.

  • The unified field will inherit the metadata from the schema where

    that field is first defined.

  • The first N fields in the schema will be ordered the same as the

    N fields in the first schema.

The resulting schema will inherit its metadata from the first input schema.

Parameters:
schemaslist of Schema

Schemas to merge into a single one.

promote_optionsstr, default default

Accepts strings “default” and “permissive”. Default: null and only null can be unified with another type. Permissive: types are promoted to the greater common denominator.

Returns:
Schema
Raises:
ArrowInvalid

If any input schema contains fields with duplicate names. If Fields of the same name are not mergeable.