I need help with this,
I have a list of lists and a list of dictionaries. The list of dictionaries has for its values, list of indexes that point to the items in the list of lists. what I need to do is to create a new list of dictionaries from those other two.
list_1 = [[a,b,c], [d,e,f], ...]
list_2 = [{key_11: [0,2] , key_12: [0]}, {key_21: [2,0], key_22: [1]}, ...]
The values of the first dictionary in list_2, point only to the first list o list_1 and so on...
What I need is a new list of dictionaries with the same keys but with values of the items on list_1[i] represented by the values of the dicts on list_2. So something like this:
return [{{key_11: [a,c] , key_12: [a]}, {key_21: [f,d], key_22: [e]}, ...]
I tried something like this:
return [{key: some_funct(val) for key, val in x.items()} for x in list_2]
and some_funct takes a value of the dictionary and returns the correct items on list_1[x] for x in list_2
I know I'm close! but I can't get some_funct to work properly and I think it's because I'm trying to map three things, every element on list_1, every dictionary on list_2 and every value for each dictionary.