Danger You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software Click here to go to the new docs pages.
Danger
You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software
Click here to go to the new docs pages.
sdv.metadata.dataset.
Metadata
Dataset Metadata.
The Metadata class provides a unified layer of abstraction over the dataset metadata, which includes both the necessary details to load the data from the hdd and to know how to parse and transform it to numerical data.
metadata (str or dict) – Path to a json file that contains the metadata or a dict representation of metadata following the same structure.
json
dict
metadata
root_path (str) – The path to which the paths found inside the metadata are relative. If not given, it defaults to the folder where the metadata is located, or to None, if no metadata is given.
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__([metadata, root_path])
Initialize self.
add_field(table, field, field_type[, …])
add_field
Add a new field to the indicated table.
add_relationship(parent, child[, …])
add_relationship
Add a new relationship between the parent and child tables.
add_table(name[, data, fields, …])
add_table
Add a new table to this metadata.
get_children(table_name)
get_children
Get tables for which the given table is parent.
get_dtypes(table_name[, ids, errors])
get_dtypes
Get a dict with the dtypes for each field of a given table.
dtypes
get_field_meta(table_name, field_name)
get_field_meta
Get the metadata dict for a table.
get_fields(table_name)
get_fields
Get the metadata of the fields of the indicated table.
get_foreign_keys(parent, child)
get_foreign_keys
Get the name of all the fields in the child that are foreign keys to this parent.
get_parents(table_name)
get_parents
Get tables for with the given table is child.
get_primary_key(table_name)
get_primary_key
Get the name of the primary key of the indicated table, if it has one.
get_table_meta(table_name)
get_table_meta
get_tables()
get_tables
Get the list with the tables found in this metadata.
load_table(table_name)
load_table
Load the data of the indicated table as a DataFrame.
load_tables([tables])
load_tables
Get a dictionary with data from multiple tables.
set_primary_key(table, field)
set_primary_key
Set the primary key field of the indicated table.
to_dict()
to_dict
Get a dict representation of this metadata.
to_json(path)
to_json
Dump this metadata into a JSON file.
validate([tables])
validate
Validate this metadata.
visualize([path, names, details])
visualize
Plot metadata usign graphviz.
Attributes
root_path