Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python max with custom function

nums = [1,2,3,1,1,3,3,4,4,3,5] #list
counts = collections.Counter(nums) # create a dict of counts
#using counts.get() fun as custom function 
return max(counts.keys(), key=counts.get)  
 
PREVIOUS NEXT
Tagged: #python #max #custom #function
ADD COMMENT
Topic
Name
5+6 =