Skip to content

Tag: min

Problems regarding “key” in the min() function

scores = {1:20, 2:40, 3:0, 4:25} min_score = min(scores, key=scores.get) I don’t quite understand the parameters that can be passed into the key. Running the above code gives me 3 which is what I wanted. scores.get return me a dict object at certain memory address. Calling scores.get() raised me an Erro…

Max and Min value for each colum of one Dataframe

Give this dataframe ‘x’: How I could get a list of pairs with the min and max of each column? The result would be: Answer You could define a function and call apply passing the function name, this will create a df with min and max as the index names: If you insist on a list of lists we can