annotation_set_to_csv

function of dascore.core.annotations source

annotation_set_to_csv(
    annotations: AnnotationSet ,
    path: str | pathlib._local.Path | None[str, Path, None] = None,
)-> ‘str’

Return the annotations as CSV text, optionally writing it to a path.

Reached as annotation_set.io.to_csv.

A bare table states one grain, so a set holding vertices is written with save instead; this is the spelling for a set of regions. The set’s dimensions are not part of the table, so reading one back states them again.

Parameters

Parameter Description
annotations The set to write.
path Where to write the text, or None to only return it.

Examples

import pandas as pd
import dascore as dc
frame = pd.DataFrame(
    {"group": ["event"], "distance_start": [10.0], "distance_end": [80.0]}
)
annotations = dc.AnnotationSet(frame, dims=("time", "distance"))
"group" in annotations.io.to_csv()
True