M
M
Mioulin2021-10-20 18:19:08
Python
Mioulin, 2021-10-20 18:19:08

How to create a multidimensional matrix (mxn) from a composite dictionary with a list of data (values)?

there is a compound dictionary in which the first key key1 (group type) leads to a list of keys key2 (group selection) that contain a one-dimensional values ​​data array that is unique for each selection.
you need to write a function that would first refer to the dictionary key 1, then from the dictionary the one-dimensional data array would be converted into a multidimensional matrix (mxn), where n columns is the number of keys, each of which corresponds to its own unique data array m
Example, that is:

1dict: HC, ASD (2 groups)
2 dict: ASD (2 samples with values) , HC (2 samples with values)

{'HC': {'01': array([0.72919255, 0.68225476, 0.46834589, .. ., 0.71843863, 0.73399546,
0.81451451]),
'02': Array ([0.31245597, 0.36639732, 0.36188738, ..., 0.53902941, 0.46416973,
0.54336855])},
'' '' '': {'0 , 0.46532123,
0.56890823]), '04': array([0.44370506, 0.58574023, 0.21442585, ..., 0.38181173, 0.62737836, 0.68650757 ]
)}} ,03,04)) ASDTOTAL.shape (4,100) When I access a specific key, there are no problems. I can't write a function that would go through all the keys and return a multidimensional matrix



Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question