index_has_overlap()

audformat.utils.index_has_overlap(obj)[source]

Check if one or more segments in the index overlap.

If the index is filewise, the result will always be False.

Parameters

obj (Union[Index, DataFrame, Series]) – object conform to table specifications

Return type

bool

Returns

True if overlap is detected, otherwise False

Examples

>>> index = filewise_index(["f1", "f2"])
>>> index_has_overlap(index)
False
>>> index = segmented_index(
...     ["f1", "f2"],
...     [0, 1],
...     [2, 3],
... )
>>> index_has_overlap(index)
False
>>> index = segmented_index(
...     ["f1"] * 2,
...     [0, 1],
...     [2, 3],
... )
>>> index_has_overlap(index)
True