I have a string that is in the format of k1=v1,k2=v2
and so on. I want to return that k
which has highest v
.
I am trying to run below code but it does not seem to work -
s1 = "0=0.0,1=4.097520999795124e-05,2=0.0007278731184387373,3=0.339028551210803,4=0.33231086508575525,5=0.32789173537500504"
stats = dict(map(lambda x: x.split('='), s1.split(',')))
x = max(stats, key=stats.get)
print(x)
This prints 1
whereas the expected output is 3
.