Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ashlinrichardson committed Aug 2, 2024
1 parent 9fdcc1e commit 1e7cbf8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions py/csv_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
fields, data = read_csv(args[1])
lookup = {fields[i]: i for i in range(len(fields))}

try: fi = lookup[args[2]]
except: err('field not found:', args[2])
try:
fi = lookup[args[2]]
except:
err('field not found:', args[2])

N = len(data[0])
sortd = [ [data[fi][i], i] for i in range(N)] # intentional naming
sortd = [[data[fi][i], i] for i in range(N)] # intentional naming
sortd.sort(reverse=False) # increasing order

print("+w", ofn)
Expand Down

0 comments on commit 1e7cbf8

Please sign in to comment.