I have two dicts:
dict_1 = {'A': ['red', 'red', 'blue'],
'B': ['red', 'green'],
'C': ['blue', 'green'], ....}
dict_2 = {'A': Counter({'red': 2, 'blue': 1}),
'B': Counter({'red': 1, 'green': 1}),
'C': Counter({'blue': 1, 'green': 1}), ....}
I need to do some simple division between them and later plot them pairwise. The desired outcome is like this or anything that can do the division:
fraction = {'A': [2/3, 1/3],
'B': [1/2, 1/2],
'C': [1/2, 1/2], ....}
Right now, I can only get the first digit divided, any advice will be appreciated! Here's my code:
fraction = { key: [v/len(colorz)] for namez, colorz in dict_1.items()
for name, color in dict_2.items()
for k, v in color.items() }