-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdicttools.py
More file actions
33 lines (29 loc) · 821 Bytes
/
dicttools.py
File metadata and controls
33 lines (29 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
""" Dictionaries and lists module
-----------------------------------
| Copyright 2022 by Joel C. Alcarez |
| [[email protected]] |
|-----------------------------------|
| We make absolutely no warranty |
| of any kind, expressed or implied |
|-----------------------------------|
| Contact primary author |
| if you plan to use this |
| in a commercial product at |
-----------------------------------
"""
def dict2descorderlist(
d: dict) -> list:
"""Creates a sorted list in
decending order from
a dictionary with counts
Args:
dict: histogram or
frequency count
Returns:
list
"""
l = [[v, k] for k, v in d.items()]
l.sort()
l.reverse()
return l