Created
May 17, 2017 11:49
-
-
Save samuell/cb59fe55fbada7007b7a11b872fae182 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sys import stdin, stdout | |
import csv | |
rdr = csv.reader(stdin, delimiter='\t') | |
wrt = csv.writer(stdout, delimiter='\t') | |
vals = [] | |
rows = [] | |
for row in rdr: | |
val = row[0] | |
val = val.replace(',','.').replace('K', '*1000').replace('M', '*1000000').replace('G', '*1000000000') | |
exec('val=' + val) | |
vals.append(val) | |
rows.append(row) | |
max = max(vals) | |
for v, r in zip(vals,rows): | |
fname = r[1] | |
graph = ('*'*round((v / max) * 100)) | |
print(fname.rjust(64), graph, r[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output and usage:
