aixd.data.utils_data.reformat_array_to_list

aixd.data.utils_data.reformat_array_to_list(arr: ndarray) List[List][source]

Reformat numpy.ndarray into a nested list. In the intended use, a row in the array corresponds to a data sample and to an item (which is again a list of values) in the returned list. Data corresponding to data objects with dim > 1 are flattened both in the input and output.

Parameters:

arr (np.ndarray) – A 2d numpy ndarray.

Returns:

List[List] – A nested list.

Examples

>>> arr = np.asarray([[1, 2, 3],[7, 8, 9]])
>>> reformat_array_to_list(np.asarray([[1, 2, 3],[7, 8, 9]]))
[[1, 2, 3], [7, 8, 9]]