Demo Data
The SDV library contains many different demo datasets that you can use to get started. Use the demo module to access the datasets and their metadata.
from sdv.datasets.demo import get_available_demos
from sdv.datasets.demo import download_demo
get_available_demos(modality='multi_table')
data, metadata = download_demo(
modality='multi_table',
dataset_name='fake_hotels'
)The demo module accesses the SDV's public dataset repository. These methods require an internet connection.
get_available_demos
Use this method to get information about all the available demos in the SDV's public dataset repository.
Parameters
(required)
modality: A string containing the type of demo data. Options are:'single_table': For data contained in a single table, where each row is independent.'multi_table': For data contained in a relational, multi-table dataset. Tables can reference each other.'sequential': For data representing ordered sequences. The sequences should be present in a single table.
[private]
s3_bucket_name: Additional, private demo datasets may be available in other buckets. If you have been given access to one of these buckets, you can input the name as a string. This is currently only available to internal, DataCebo users.[private]
credentials: Provide a dictionary with the SDV credentials in order to access the bucket. The expected keys are'username'and'license_key'. This is currently only available to internal, DataCebo users.
Returns A pandas DataFrame object containing the name of the dataset, its size (in MB) and the number of tables it contains.
download_demo
Use this method to download a demo dataset from the SDV's public dataset repository.
Parameters
(required)
modality: A string containing the type of demo data. Options are:'single_table': For data contained in a single table, where each row is independent.'multi_table': For data contained in a relational, multi-table dataset. Tables can reference each other.'sequential': For data representing ordered sequences. The sequences should be present in a single table.
(required)
dataset_name: A string with the name of the demo dataset. You can use any of the dataset names from theget_available_demomethod.output_folder_name: A string with the name of a folder. If provided, this method will download the data and metadata into the folder, in addition to returning the data.(default)
None: Do not save the data into a folder. The data will still be returned so that you can use it in your Python script.
[private]
s3_bucket_name: Additional, private demo datasets may be available in other buckets. If you have been given access to one of these buckets, you can input the name as a string. This is currently only available to internal, DataCebo users.[private]
credentials: Provide a dictionary with the SDV credentials in order to access the bucket. The expected keys are'username'and'license_key'. This is currently only available to internal, DataCebo users.
Output A tuple (data, metadata).
The data is a dictionary that maps each table name to a pandas DataFrame containing the demo data for that table. The metadata is a Metadata object that describes the data.
get_source
Some datasets have a source file that describes where the dataset comes from. This can include information like a URL, citations for the original publication, and other information that tracks the dataset's provenance. Use this function to get all this source information.
Parameters
(required)
modality: A string containing the type of demo data. Options are:'single_table': For data contained in a single table, where each row is independent.'multi_table': For data contained in a relational, multi-table dataset. Tables can reference each other.'sequential': For data representing ordered sequences. The sequences should be present in a single table.
(required)
dataset_name: A string with the name of the demo dataset. You can use any of the dataset names from theget_available_demomethod.output_filepath: A string with the name of a file path. If provided, this method will create the file and write the source information to the file, in addition to returning it.(default)
None: Do not save the source information into a file. The contents will still be returned so that you can print it out and read it.
[private]
s3_bucket_name: Additional, private demo datasets may be available in other buckets. If you have been given access to one of these buckets, you can input the name as a string. This is currently only available to internal, DataCebo users.[private]
credentials: Provide a dictionary with the SDV credentials in order to access the bucket. The expected keys are'username'and'license_key'. This is currently only available to internal, DataCebo users.
Output A string containing the contents of the source information. You can print it out to read it. (If no source information is available for a dataset, the function returns None and no file will be written.)
get_readme
Some datasets have a README file that describes more information about what the dataset means. This could include explanations for naming conventions used in the dataset, mappings for ID codes, or business logic. Use this function to get the README (if it exists).
README information is coming soon! At this time, SDV demo datasets do not contain any README information. If you're looking for more information about the dataset, we recommend getting the source. From there, you'll be able to navigate to any URLs or contact the original authors as needed.
Parameters
(required)
modality: A string containing the type of demo data. Options are:'single_table': For data contained in a single table, where each row is independent.'multi_table': For data contained in a relational, multi-table dataset. Tables can reference each other.'sequential': For data representing ordered sequences. The sequences should be present in a single table.
(required)
dataset_name: A string with the name of the demo dataset. You can use any of the dataset names from theget_available_demomethod.output_filepath: A string with the name of a file path. If provided, this method will create the file and write the README information to the file, in addition to returning it.(default)
None: Do not save the README information into a file. The contents will still be returned so that you can print it out and read it.
[private]
s3_bucket_name: Additional, private demo datasets may be available in other buckets. If you have been given access to one of these buckets, you can input the name as a string. This is currently only available to internal, DataCebo users.[private]
credentials: Provide a dictionary with the SDV credentials in order to access the bucket. The expected keys are'username'and'license_key'. This is currently only available to internal, DataCebo users.
Output A string containing the contents of the README information. You can print it out to read it. (If no README information is available for a dataset, the function returns None and no file will be written.)
save_resource
This is a generic function to download and save any resource related to a dataset such as the data, metadata, readme, or source.
Parameters
(required)
modality: A string containing the type of demo data. Options are:'single_table': For data contained in a single table, where each row is independent.'multi_table': For data contained in a relational, multi-table dataset. Tables can reference each other.'sequential': For data representing ordered sequences. The sequences should be present in a single table.
(required)
dataset_name: A string with the name of the demo dataset. You can use any of the dataset names from theget_available_demomethod.(required)
resource_filename: A string with the name of the resource to download and save. Please include the full name including the suffix.Current options include:
"data.zip","metadata.json","README.txt", or"SOURCE.txt". Not all resources are available for every dataset. In the future, additional resources may be available too.
(required)
output_filepath: A string with the name of a file path. If provided, this method download and save the resource locally at the filepath provided.[private]
s3_bucket_name: Additional, private demo datasets may be available in other buckets. If you have been given access to one of these buckets, you can input the name as a string. This is currently only available to internal, DataCebo users.[private]
credentials: Provide a dictionary with the SDV credentials in order to access the bucket. The expected keys are'username'and'license_key'. This is currently only available to internal, DataCebo users.
Output: None. The requested resource is saved to the file path provided. If the resource doesn't exist for the dataset, you will see a warning and nothing will be saved.
Last updated