0

I have a dictionary which has the following structure :

d = {0: [array(), array(), array(), ..]
     1: [array(), array(), array(), ..]
     2: [array(), array(), array(), ..]}

What is the best way to iterate over this type of dictionary? I want to append values and print all the arrays (separately) along with dict keys.

The output should be something like this :

0 []
0 []
.
.
1 []
1 []
.
.
2 []
2 []
.
.
  • 3
    showing your desired output is going to be more effective than describing it. – Paul H Jul 02 '18 at 16:29
  • 2
    This data structure is bizarre. Why does it look like this? Why a dict, if the keys are just going to be an increasing sequence of ints? Why lists of arrays inside the dict? Why not just a single higher-dimensional array, or if the inner lists aren't the same length, why not a list of lists of arrays? – user2357112 Jul 02 '18 at 16:37
  • 1
    There are standard ways of iterating on a Python dictionary. That fact that the values are lists of arrays doesn't change that. – hpaulj Jul 02 '18 at 16:44
  • What is **array()** here in your code? – hygull Jul 02 '18 at 16:48
  • Each array() is 1d array of floats. – Rohan Vardhan Jul 02 '18 at 16:57

0 Answers0