aixd.data.utils_data.reformat_dataframe_to_dictlist

aixd.data.utils_data.reformat_dataframe_to_dictlist(dataframe: DataFrame, listwrap: bool = False) List[Dict][source]

Reformats data formatted as a dataframe into a dictionary. In the intended usage, each row of the dataframe corresponds to one data sample and each row to a data object. The column names will be mapped to keys in the dictionary. To access a particular value, use: dct[nth_sample][column_name_as_key][ith_dimension].

Parameters:
  • dataframe (pd.DataFrame) – A dataframe object.

  • listwrap (bool, optional, default=False) – If True, 1-dimensional values will be put into a 1-item list (e.g., 3.14 -> [3.14]).

Returns:

List[Dict] – A list of dictionaries, where each item in the list is a dictionary corresponding to one sample.