mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 08:26:41 +00:00
MOved the general sort to be incase no preferred value
This commit is contained in:
parent
d78ed2bc86
commit
2d12280dc9
1 changed files with 3 additions and 1 deletions
|
@ -377,12 +377,14 @@ def sort_instances(df, sort_by, preferred=None):
|
|||
"""
|
||||
|
||||
try:
|
||||
df = df.sort_values(by=sort_by)
|
||||
|
||||
if preferred:
|
||||
df['priority'] = (df[sort_by] == preferred).astype(int)
|
||||
df = df.sort_values(by=['priority', sort_by], ascending=[False, True]).drop(columns='priority')
|
||||
|
||||
else:
|
||||
df = df.sort_values(by=sort_by)
|
||||
|
||||
except Exception as err:
|
||||
print_colors('[-] Sorting failed',is_error=True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue