diff --git a/piker/calc.py b/piker/calc.py index f5efae25..0ed811fc 100644 --- a/piker/calc.py +++ b/piker/calc.py @@ -9,6 +9,10 @@ def humanize(number): """Convert large numbers to something with at most 3 digits and a letter suffix (eg. k: thousand, M: million, B: billion). """ + try: + float(number) + except ValueError: + return 0 if not number or number <= 0: return number mag2suffix = {3: 'k', 6: 'M', 9: 'B'}