load_table()¶
- audb.load_table(name, table, *, version=None, map=None, pickle_tables=True, cache_root=None, num_workers=1, verbose=True)[source]¶
Load a database table.
If you are interested in a single table from a database you can use
audb.load_table()
to directly load it. This will not download any media files to your disk, but share the cache withaudb.load()
.- Parameters
name (
str
) – name of databasetable (
str
) – load table from databasemap (
Optional
[dict
[str
,str
|Sequence
[str
]]]) – map scheme or scheme fields to column values. For example if your table holds a columnspeaker
with speaker IDs, which is assigned to a scheme that contains a dict mapping speaker IDs to age and gender entries,map={'speaker': ['age', 'gender']}
will replace the column with two new columns that map ID values to age and gender, respectively. To also keep the original column with speaker IDS, you can domap={'speaker': ['speaker', 'age', 'gender']}
pickle_tables (
bool
) – ifTrue
, tables are cached locally in their original format and as pickle files. This allows for faster loading, when loading from cachecache_root (
Optional
[str
]) – cache folder where databases are stored. If not setaudb.default_cache_root()
is usednum_workers (
Optional
[int
]) – number of parallel jobs or 1 for sequential processing. IfNone
will be set to the number of processors on the machine multiplied by 5verbose (
bool
) – show debug messages
- Return type
- Returns
database table
- Raises
ValueError – if a table is requested that is not part of the database
Examples
>>> df = load_table("emodb", "emotion", version="1.4.1", verbose=False) >>> df[:3] emotion emotion.confidence file wav/03a01Fa.wav happiness 0.90 wav/03a01Nc.wav neutral 1.00 wav/03a01Wa.wav anger 0.95 >>> df = load_table("emodb", "files", version="1.4.1", verbose=False) >>> df[:3] duration speaker transcription file wav/03a01Fa.wav 0 days 00:00:01.898250 3 a01 wav/03a01Nc.wav 0 days 00:00:01.611250 3 a01 wav/03a01Wa.wav 0 days 00:00:01.877812500 3 a01 >>> df = load_table( ... "emodb", ... "files", ... version="1.4.1", ... map={"speaker": "age"}, ... verbose=False, ... ) >>> df[:3] duration transcription age file wav/03a01Fa.wav 0 days 00:00:01.898250 a01 31 wav/03a01Nc.wav 0 days 00:00:01.611250 a01 31 wav/03a01Wa.wav 0 days 00:00:01.877812500 a01 31