I have a dictionary with almost 100,000 (key, value) pairs and the majority of the keys map to the same values. For example:
mydict = {\'a\': 1, \'c\': 2, \'
reversed_dict = collections.defaultdict(list) for key, value in dict_.iteritems(): reversed_dict[value].append(key)