diff --git a/python/obitools3/commands/stats.pyx b/python/obitools3/commands/stats.pyx index 07c8edf..e6e79f6 100755 --- a/python/obitools3/commands/stats.pyx +++ b/python/obitools3/commands/stats.pyx @@ -244,7 +244,9 @@ def run(config): "\t count" + \ "\t total" print(hcat) - for c in catcount: + sorted_stats = sorted(catcount.items(), key = lambda kv:(kv[1], kv[0]), reverse=True) + for i in range(len(sorted_stats)): + c = sorted_stats[i][0] for v in c: print(pcat % str(v)+"\t", end="") for m in config['stats']['minimum']: