I have the following dictionary and I get the max value in every nested dictionary, but also I want to get the key that contains it. How can I get the key?
Dictionary:
{0: {'No': 0.0008701660440099657, 'Yes': 0.00041988149400856126},
1: {'No': 0.00030532988393349125, 'Yes': 0.0004650428587258767},
2: {'No': 0.0009029060356133256, 'Yes': 0.0007394058270439404},
3: {'No': 5.692242884555282e-05, 'Yes': 0.0005919332682707075},
4: {'No': 0.00015013263827995824, 'Yes': 0.00013704067699909492},
5: {'No': 0.0006475515553117131, 'Yes': 0.000398292472360402},
6: {'No': 0.00015299971518718442, 'Yes': 0.000636069387240845},
7: {'No': 0.0003432474070424342, 'Yes': 0.0001701115953231753},
8: {'No': 0.00029659442779058097, 'Yes': 0.0001243229615986186},
9: {'No': 0.0002346339088222795, 'Yes': 4.1301441738705087e-05}}
Code that gets max value:
for i in range(len(res_dic)):
print(max(res_dic[i].values()))
Expected output:
No, 0.0008701660440099657