All APIs of TSDB

TSDB logo

TSDB

TSDB (Time Series Data Beans): a Python toolbox loads hundreds of public time-series datasets for machine/deep learning with a single line of code.

tsdb.list()[source]

List the database.

Returns:

DATABASE – A dict contains all datasets’ names and download links.

Return type:

dict

tsdb.load(dataset_name, use_cache=True)[source]

Load dataset with given name.

Parameters:
  • dataset_name (str,) – The name of the specific dataset in database.DATABASE.

  • use_cache (bool,) – Whether to use cache (including data downloading and processing)

Returns:

Loaded dataset in a Python dict.

Return type:

result

tsdb.download_and_extract(dataset_name, dataset_saving_path)[source]

Wrapper of _download_and_extract.

Parameters:
  • dataset_name (str,) – The name of a dataset available in tsdb.

  • dataset_saving_path (str,) – The local path for dataset saving.

Return type:

None

tsdb.list_cache()[source]

List names of all cached datasets.

Returns:

A list contains all cached datasets’ names.

Return type:

list,

tsdb.delete_cache(dataset_name=None, only_pickle=False)[source]

Delete CACHED_DATASET_DIR if exists.

Parameters:
  • dataset_name (str, optional) – The name of the specific dataset in database.DATABASE. If dataset is not cached, then abort. Delete all cached datasets if dataset_name is left as None.

  • only_pickle (bool,) – Whether to delete only the cached pickle file. When the preprocessing pipeline TSDB is changed, users may want to only delete the cached pickle file which is generated by the old pipeline but keep the downloaded raw data. This option is designed for this purpose.

Return type:

None

tsdb.purge_path(path, ignore_errors=True)[source]

Delete the given path. It will be deleted if a file is given. Itself and all its contents will be purged will a fold is given.

Parameters:
  • path (str) – It could be a file or a fold.

  • ignore_errors (bool) – Errors are ignored if ignore_errors is set.

Return type:

None

tsdb.pickle_dump(data, path)[source]

Pickle the given object.

Parameters:
  • data (object) – The object to be pickled.

  • path (str) – Saving path.

Return type:

path if succeed else None

tsdb.pickle_load(path)[source]

Load pickled object from file.

Parameters:

path (str) – Local path of the pickled object.

Returns:

Pickled object.

Return type:

Object

tsdb.migrate(old_path, new_path)[source]

Migrate files in a directory from old_path to new_path.

Parameters:
  • old_path (str) – The old path of the dataset.

  • new_path (str) – The new path of the dataset.

Return type:

None

tsdb.migrate_cache(target_path)[source]

Migrate datasets from old_path to new_path.

Parameters:

target_path (str) – The new path for TSDB to store cached datasets.

Return type:

None