What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-18 14:25:46
list count frequency python
import collections a = [1,1,1,1,2,2,2,2,3,3,4,5,5] counter=collections.Counter(a) print(counter) # Counter({1: 4, 2: 4, 3: 2, 5: 2, 4: 1}) print(counter.values()) # [4, 4, 2, 1, 2] print(counter.keys()) # [1, 2, 3, 4, 5] print(counter.most_common(3)) # [(... Add solution -
Python 2021-11-08 01:22:11
freq count in python
import collections a = [1,1,1,1,2,2,2,2,3,3,4,5,5] counter=collections.Counter(a) print(counter) # Counter({1: 4, 2: 4, 3: 2, 5: 2, 4: 1}) print(counter.values()) # [4, 4, 2, 1, 2] print(counter.keys()) # [1, 2, 3, 4, 5] print(counter.most_common(3)) # [(... Add solution -
Python 2021-10-23 12:36:21
find frequency of numbers in list python
import collections a = [1,1,1,1,2,2,2,2,3,3,4,5,5] counter=collections.Counter(a) print(counter) # Counter({1: 4, 2: 4, 3: 2, 5: 2, 4: 1}) print(counter.values()) # [4, 4, 2, 1, 2] print(counter.keys()) # [1, 2, 3, 4, 5] print(counter.most_common(3)) # [(... Add solution -
Python 2021-09-30 15:29:03
python counter nested dictionary
import collections a = collections.defaultdict(collections.Counter) inf = [('fruit','apple'),('car','truck'),('fruit','banana'),('fruit','banana')] for category,item in inf: a[category][item] = a[category][item] + 1 #print(a) #{'fruit': Counter({'b... Add solution
Best helpers
Cynthia
+5
Eve noonan
+5
Martinako
+5
Numeri
+5
John Weisz
+5
Rocky DeHart
+5
Tammy Lin
+5
SunnyHills
+5
Ishan Yadav
+5
Aown Ali
+5
Terry3497
+5
Xkcvk2511
+5
Jean Luis
+5