Python iterrate on two keywords object
Solution 1:
You can try this:
import numpy as np
params = dict(loc=[1,2,3,6,10],
scale=[4,6,7,8,5],
size=[10,9,7,8,5])
ds = (dict(zip(params.keys(), vals)) for vals in zip(*params.values()))
list(np.random.normal(**d) for d in ds)
Solution 2:
If you want to use map
, you could do:
params = (loc, scale, size)
names = ('loc', 'scale', 'size')
list(map(lambda p: np.random.normal(**dict(zip(names, p))),
zip(*params)))