select

method of dascore.core.annotations.AnnotationSet source

select(
    self ,
    **filters ,
)-> ‘AnnotationSet’

Return the set filtered on its columns.

Each name is a column of the annotations or the features table; a name on both is refused, id always. A value matches equal cells, a string is a glob, a list or set is membership, a (low, high) tuple is an inclusive range with either end None (numbers, times and durations only), and <name>_min/<name>_max bound one end.

A features filter drops the features failing it, members and all; a lone row, whose features columns are blank, fails one. geometry (spelling a group group) and basis are always features filters. An annotations filter drops the rows failing it and any feature left with no members, and refuses to leave a path or polygon too few vertices. acquisition_key and data_id filter rows on the value each inherits. set filters both tables by label. Dimensions are filtered with overlapping.

Examples

import pandas as pd
import dascore as dc
frame = pd.DataFrame(
    {"time": [1.0, 2.0, 3.0], "phase": ["P", "S", "P"],
     "confidence": [0.9, 0.95, 0.3]}
)
picks = dc.AnnotationSet(frame, dims=("time", "distance"))
len(picks.select(phase="P", confidence=(0.8, None)))
1