synthesized.DataFrameMeta

class DataFrameMeta(name, children=None, id_index=None, time_index=None, column_aliases=None, columns=None, num_columns=None, num_rows=None, annotations=None)

Describe the schema and data types of an arbitrary data frame.

Each column is described by a derived ValueMeta object.

Parameters
  • id_index (Optional[str]) – NotImplemented

  • time_index (Optional[str]) – NotImplemented

  • column_aliases (Optional[Dict[str, str]]) – dictionary mapping column names to an alias.

  • annotations (Optional[List[str]]) – A list of the metas’ names in the dataframe that have been annotated.

Methods

__init__(name[, children, id_index, …])

Initialize self.

annotate(annotation)

convert_df_for_children(df)

Expands the dataframe to contain the columns of the metas children.

copy()

Returns a shallow copy of the data frame meta.

extract(df)

Extract the children of this Meta.

from_dict(d)

Construct a Meta from a dictionary.

revert_df_from_children(df)

Collapses the dataframe to no longer contain the meta’s children columns.

to_dict()

Convert the Meta to a dictionary.

unannotate(annotation)

update_meta(df)

update the children of this Meta.

Attributes

children

Return the children of this Meta.

class_name

property children

Return the children of this Meta.

Return type

Sequence[Meta]

convert_df_for_children(df)

Expands the dataframe to contain the columns of the metas children.

Parameters

df (pandas.core.frame.DataFrame) –

copy()

Returns a shallow copy of the data frame meta.

Return type

DataFrameMeta

extract(df)

Extract the children of this Meta.

Return type

DataFrameMeta

Parameters

df (pandas.core.frame.DataFrame) –

classmethod from_dict(d)

Construct a Meta from a dictionary. See example in Meta.to_dict() for the required structure. .. seealso:: DataFrameMeta.to_dict: convert a DataFrameMeta to a dictionary

Return type

DataFrameMeta

Parameters

d (Dict[str, object]) –

revert_df_from_children(df)

Collapses the dataframe to no longer contain the meta’s children columns.

Parameters

df (pandas.core.frame.DataFrame) –

to_dict()

Convert the Meta to a dictionary.

The tree structure is converted to the following form:

{
    attr: value,
    children: {
        name: {**value_meta_attr.__dict__}
    }
}

See also

Meta.from_dict: construct a Meta from a dictionary

Return type

Dict[str, object]

update_meta(df)

update the children of this Meta.

Return type

DataFrameMeta

Parameters

df (pandas.core.frame.DataFrame) –