metasyn.MetaFrame
- class metasyn.MetaFrame(meta_vars, n_rows=None, file_format=None, name='single_table')
Container for statistical metadata describing a dataset.
This class is used to fit a MetaFrame to a Polars DataFrame, serialize and save the MetaFrame to a file, read a MetaFrame from a file, and create a synthetic Polars DataFrame.
A MetaFrame represents a metadata frame, which is a structure that holds statistical metadata about a dataset. The data contained in a MetaFrame follows the Generative Metadata Format (GMF). The metadata is contained in a collection of MetaVar objects, with each MetaVar representing a column (variable).
A MetaFrame can easily be created using the
fit_dataframemethod, which takes a Polars DataFrame and fits a MetaFrame to it.- Parameters:
meta_vars (
List[MetaVar]) – List of variables representing columns in a DataFrame.n_rows (
Optional[int]) – Number of rows in the original DataFrame.privacy_package – Package that supplies the distributions.
file_format (Union[None, BaseFileInterface, dict[str, Any]])
name (str)
- __init__(meta_vars, n_rows=None, file_format=None, name='single_table')
- Parameters:
meta_vars (List[MetaVar])
n_rows (int | None)
file_format (None | BaseFileInterface | dict[str, Any])
name (str)
Methods
__init__(meta_vars[, n_rows, file_format, name])export(fp[, validate])Export, deprecated method, use Metaframe.save instead.
fit_dataframe(df[, var_specs, plugins, ...])Create a metasyn object from a polars (or pandas) dataframe.
from_config(meta_config)Create a MetaFrame using a configuration, but without a DataFrame.
from_dict(gmf_dict[, table_name])from_json(fp[, validate])Import, deprecated method, use Metaframe.load_json instead.
load(fp[, validate, table_name])Read a MetaFrame from a JSON or TOML GMF file.
load_json(fp[, validate, table_name])Read a MetaFrame from a JSON file.
load_toml(fp[, validate, table_name])save(fp[, validate])Serialize and save the MetaFrame to a JSON or TOML file, following the GMF format.
save_json(fp[, validate])Serialize and save the MetaFrame to a JSON file, following the GMF format.
save_toml(fp[, validate])synthesize([n, seed, progress_bar])Create a synthetic Polars dataframe.
to_dict()Create dictionary with the properties for recreation.
to_json(fp[, validate])Export, deprecated method, use Metaframe.save_json instead.
write_synthetic([file_name, n, seed, ...])Write a synthetic dataset to a file.
Attributes
descriptionsReturn the descriptions of the columns.
file_formatn_columnsNumber of columns of the original dataframe.