Skip to content

Instantly share code, notes, and snippets.

@samuell
Created May 17, 2017 11:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save samuell/cb59fe55fbada7007b7a11b872fae182 to your computer and use it in GitHub Desktop.
Save samuell/cb59fe55fbada7007b7a11b872fae182 to your computer and use it in GitHub Desktop.
#!/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])
@samuell
Copy link
Author

samuell commented May 17, 2017

Output and usage:
selection_222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment