Q:

Make a huge dict from multiple numpy arrays

I am trying to transform multiple numpy arrays in a huge dictionary of tasks in python. I am sure this problem has been solved, but I am not sure how to search for such result. 
Below is an example of what I am trying to accomplish.
I'm getting mixed up with for and while loops in my tries. If someone as a relatively efficient way of solving this, ideally, I wish to be able to add as many keys to the initial dict without changing the function to generate the output.
#INPUT
initial = {
         'diameter': array([ 20.,  30.,  40.]),
         'medium': array([ 1, 1.5, 2]),
         'thickness': array([ 100, 150, 200]),
         'density': array([1])
         }

#OUTPUT
output = {
   "task1":{'id'=1, 'diameter':20, 'medium':1, 'thickness':100, 'density':1},
   "task2":{'id'=2, 'diameter':30, 'medium':1, 'thickness':100, 'density':1},
   "task3":{'id'=3, 'diameter':40, 'medium':1, 'thickness':100, 'density':1},
   "task4":{'id'=4, 'diameter':20, 'medium':1.5, 'thickness':100, 'density':1},
   "task5":{'id'=5, 'diameter':30, 'medium':1.5, 'thickness':100, 'density':1},

           ...

   "taskN":{'id'=N, 'diameter':40, 'medium':2, 'thickness':200, 'density':1},

A:

If the final ordering of output is not important you can achieve this using itertools.product
from itertools import product

all_prods = product(*initial.values())
output = dict()
keys = ('id', *initial.keys())
count = 1

for prod in all_prods:
    vals = (count, *prod)
    ready = zip(keys, vals)
    output.update({'task{}'.format(count): dict(ready)})
    count += 1

output

{'task1': {'id': 1,
  'diameter': 20.0,
  'medium': 1.0,
  'thickness': 100,
  'density': 1},
 'task2': {'id': 2,
  'diameter': 20.0,
  'medium': 1.0,
  'thickness': 150,
  'density': 1},
 'task3': {'id': 3,
  'diameter': 20.0,
  'medium': 1.0,
  'thickness': 200,
  'density': 1},
...etc

If order does matter then we should pre-sort beforehand
from operator import itemgetter

initialize same variables as before...

for prod in sorted(all_prods, key=itemgetter(1,2)):
    same as before....

output

{'task1': {'id': 1,
  'diameter': 20.0,
  'medium': 1.0,
  'thickness': 100,
  'density': 1},
 'task2': {'id': 2,
  'diameter': 30.0,
  'medium': 1.0,
  'thickness': 100,
  'density': 1},
 'task3': {'id': 3,
  'diameter': 40.0,
  'medium': 1.0,
  'thickness': 100,
  'density': 1},
 'task4': {'id': 4,
  'diameter': 20.0,
  'medium': 1.0,
  'thickness': 150,
  'density': 1},
  ...etc

