# flip key and values by_name = {"Negative": -1, "Positive": 1, "Neutral": 0, "Mixed": 2} by_num = {value: key for key, value in by_name.items()} # ouput = {-1: 'Negative', 1: 'Positive', 0: 'Neutral', 2: 'Mixed'}