Stratified Samplig, key=mean_pos.get argument

Hello all,

Could you please explain the functioning of the key=mean_pos.get argument in max() function? Just wanted to get a little bit more background regarding that part of code.

Screen Link:

Thank you in advance.

hi @Malgorzata Welcome to DQ Community!

for a detailed information, this link is helpful

the key = mean_pos.get part will get the dictionary key of the value that is maximum in the dictionary, assuming mean_pos here is a dictionary.

for example: test_dict = {"a" : 3, "b" : 0, "c" : 5}
max of all values is 5 and the key for that value is ā€œcā€. so the get method will return "c" as output.

1 Like