Column¶
- class audformat.Column(*, scheme_id=None, rater_id=None, description=None, meta=None)[source]¶
Table column.
Represents a table column (see
audformat.Table) and optionally links it to a scheme (seeaudformat.Scheme) and a rater (seeaudformat.Rater).- Parameters:
Examples
>>> Column(scheme_id="emotion") {scheme_id: emotion}
__eq__()¶
description¶
- Column.description¶
Description
dump()¶
from_dict()¶
get()¶
- Column.get(index=None, *, map=None, copy=True, as_segmented=False, allow_nat=True, root=None, num_workers=1, verbose=False)[source]¶
Get labels.
By default, all labels of the column are returned, use
indexto get a subset.Examples are provided with the table specifications.
- Parameters:
index (
Index) – index conform to table specificationscopy (
bool) – return a copy of the labelsmap (
str) – map scheme or scheme field to column values. For example if your column holds speaker IDs and is assigned to a scheme that contains a dict mapping speaker IDs to age entries,map='age'will replace the ID values with the age of the speakeras_segmented (
bool) – if set toTrueand column has a filewise index, the index of the returned column will be converted to a segmented index.startwill be set to0andendtoNaTor to the file duration ifallow_natis set toFalse. If column belongs to a miscellaneous table, this and the following arguments have no effectallow_nat (
bool) – if set toFalse,end=NaTis replaced with file durationroot (
str) – root directory under which the files are stored. Provide if file names are relative and database was not saved or loaded from disk. IfNoneaudformat.Database.rootis used. Only relevant ifallow_natis set toFalsenum_workers (
int|None) – number of parallel jobs. IfNonewill be set to the number of processors on the machine multiplied by 5verbose (
bool) – show progress bar
- Return type:
- Returns:
labels
- Raises:
FileNotFoundError – if file is not found
RuntimeError – if column is not assigned to a table
ValueError – if trying to map without a scheme, or from a scheme that has no labels, or from a scheme that has only a list of labels, or to a non-existing field
meta¶
- Column.meta¶
Dictionary with meta fields
rater¶
- Column.rater¶
Rater object.
- Returns:
rater object or
Noneif not available
rater_id¶
- Column.rater_id¶
Rater identifier
scheme¶
- Column.scheme¶
Scheme object.
- Returns:
scheme object or
Noneif not available
scheme_id¶
- Column.scheme_id¶
Scheme identifier
set()¶
- Column.set(values, *, index=None)[source]¶
Set labels.
By default, all labels of the column are replaced, use
indexto set a subset. If columns is assigned to aSchemevalues will be automatically converted to match its dtype.Examples are provided with the table specifications.
- Parameters:
- Raises:
RuntimeError – if column is not assign to a table
ValueError – if trying to set values of a filewise column using a segmented index
ValueError – if values cannot be converted to match the schemes dtype
table¶
- Column.table¶
Table object.
- Returns:
table object or
Noneif not assigned yet