update

method of dascore.core.annotations.AnnotationSet source

update(
    self ,
    feature = None,
    annotation = None,
    **columns ,
)-> ‘AnnotationSet’

Return a set with columns of one feature or one annotation changed.

Parameters

Parameter Description
feature The id of the feature to change.
annotation The id of the annotation to change; a row stating no id cannot be
named, so it cannot be edited.
**columns The cells to set. An id does not change, nor does a feature’s
kind. An annotation’s coordinates and feature_id may: a row
moved into a path or polygon is appended to its part 0, a group
it leaves empty is dropped. Any edit to the members of a path
drawn from a basis clears the path’s basis, since the members no
longer come from it; every verb follows that rule.

Examples

import pandas as pd
import dascore as dc
frame = pd.DataFrame({"time": [1.0], "feature_id": ["event_1"]})
ann = dc.AnnotationSet(frame, dims=("time",))
ann.update(feature="event_1", magnitude=2.5)["event_1"].extra["magnitude"]
2.5