Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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}), ....}
- fraction = {'A': [2/3, 1/3],
- 'B': [1/2, 1/2],
- 'C': [1/2, 1/2], ....}
- 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() }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement