merge

method of dascore.core.annotations.AnnotationSet source

merge(
    self ,
    *others: AnnotationSet ,
)-> ‘AnnotationSet’

Return this set combined with others.

The sets share dimensions, in any order; the result keeps this set’s. Feature ids, and annotation ids where stated, are unique across all of them, and a basis key shared between them names one curve. Each set’s sets join, a label in two sets refused. The attributes are otherwise this set’s, with column documentation joined; a column two sets give different dtypes loses its declaration, as in a loaded collection. Where every set states the same acquisition_key (or data_id) it stays; otherwise the result states none, and each row is stamped with the value it had, so the result does not depend on the order the sets are given in.

Examples

import pandas as pd
import dascore as dc
hand = dc.AnnotationSet(
    pd.DataFrame({"time": [1.0]}), dims=("time",), data_id="a"
)
auto = dc.AnnotationSet(
    pd.DataFrame({"time": [2.0]}), dims=("time",), data_id="b"
)
merged = hand.merge(auto)
merged.attrs.data_id, [x.data_id for x in merged]
('', ['a', 'b'])