How do i map a dictionary over lists of np.ndarrays?
I have a dictionary containing a range of keys and values. It looks something like this:
{1: 0.5,
2: 0.51,
3: 0.34,
4: 0.38,
5: 0.4,
6: 0.27,}
In addition, i have a list object containing a range of numpy arrays which looks like this:
[array([1,2,3]),
array([4,3,5,6]),
array([1,4,6,2,3])]
I want to map the dictionary over the arrays to replace each value in each array with its corresponding key value in the dictionary. It will yield something like this:
[array([0.5,0.51,0.34]),
array([0.38,0.34,0.4,0.27]),
array([0.5,0.38,0.27,0.51,0.34])]
Finally i want to take the mean of each array in the above structure and append this value to a data frame.
Any suggestions?