aixd.data.utils_data.reformat_dataframe_to_list
- aixd.data.utils_data.reformat_dataframe_to_list(dataframe: DataFrame) List[List] [source]
Reformats a pandas dataframe into a nested list. In the output, 1st-level items correspond to the rows in the dataframe (e.g. samples), 2nd-level items correspond to the data values.
- Parameters:
dataframe (pd.DataFrame) – Dataframe containing data.
- Returns:
List[List] – List of lists. They are always flattened.
Examples
>>> dataframe = pd.DataFrame(data = {'a':[[1,1],[7,7]], 'b':[2,8], 'c':[3,9] }) >>> reformat_dataframe_to_list(dataframe) [[1, 1, 2, 3], [7, 7, 8, 9]]