Act fast, special offers end soon! Up to $294 is savings when you get Premium today.
Get offer codes

Calculate mode dynamically

Special Cases

amax = 0
key1 = ""

for key,values in gr_freq_table.items():
    print(key,values)
    if values > amax:
        amax=values
        key1=key
    
    
mode=int(key1.mid)

interval.mid() documentation

As we got the pandas class interval , we can use its mid property to assign it as mode.

1 Like

Reminder to format your code with 3 backticks (`)@eashwary (below the Esc key on a US keyboard)

got confused ` with ’ , thanks , will keep in mind.

1 Like

No worries @eashwary! Thanks for contributing your alternative solutions to the community! Keep them coming! :+1: