join_schemes()

audformat.utils.join_schemes(dbs, scheme_id)[source]

Join and update scheme of databases.

This joins the given scheme of several databases using audformat.utils.join_labels() and replaces the scheme in each database with the joined one. The dtype of all audformat.Column objects that reference the scheme in the databases will be updated. Removed labels are set to NaN.

This might be useful, if you want to combine databases with audformat.Database.update().

Joining schemes that use labels from a misc table is not supported. Please use audformat.Database.update() instead.

Parameters
  • dbs (Sequence[Database]) – sequence of databases

  • scheme_id (str) – scheme ID of a scheme with labels that should be joined

Raises

ValueError – if scheme labels are of different dtype or not list or dict

Examples

>>> db1 = Database("db1")
>>> db2 = Database("db2")
>>> db1.schemes["scheme_id"] = Scheme(labels=["a"])
>>> db2.schemes["scheme_id"] = Scheme(labels=["b"])
>>> join_schemes([db1, db2], "scheme_id")
>>> db1.schemes
scheme_id:
  dtype: str
  labels: [a, b]