crowsetta.formats.bbox.audbbox.df_to_lines#
- crowsetta.formats.bbox.audbbox.df_to_lines(df: DataFrame) list[str] [source]#
Convert a :type:`pandas.DataFrame` to a
list
ofstr
that can be saved as a txt file in Audacity extended label track format.This function is (roughly) the inverse of
crowsetta.formats.bbox.audbbox.txt_to_records()
.- Parameters:
df (pandas.DataFrame) – With contents of a txt file in Audacity extended label track format, after being loaded and parsed by
crowsetta.formats.bbox.audbbox.audbbox_txt_to_df()
- Returns:
lines – List of strings that can be saved to a text file by calling
writelines()
.- Return type:
Notes
We work with Audacity txt files this way, instead of munging and then calling
pandas.DataFrame.to_csv()
, so that we can be sure that we can round-trip data without corrupting it.