I have the following dictionary:
d = {'A': {'A1': 2, 'A4': 4, 'A5': 1}, 'B': {'B3': 1, 'B7': 8, 'B5': 2}}
How can I rearrange the dictionary to organize the values from lowest to highest order? I am expecting to have the following output after rearranging the dictionary based on the values:
d = {'A': {'A5': 1, 'A1': 2, 'A4': 4}, 'B': {'B3': 1, 'B5': 2, 'B7': 8,}}
I tried to use the sorted option, d = sorted(d.items())
, but it sorts the dictionary based on the keys.