]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/blobdiff - app.py
Fix "ValueError: cannot convert float NaN to integer"
[coffee/coffee-flask.git] / app.py
diff --git a/app.py b/app.py
index 0ad32981d0484820d13b826bd20ed367a9db57b8..473da298079a73722f062943ed2634e71be1f581 100644 (file)
--- a/app.py
+++ b/app.py
@@ -200,7 +200,7 @@ def coffee_graph_flavors():
     if "normalize" in matplotlib.pyplot.pie.__code__.co_varnames:
         # Matplotlib >= 3.3.0
         ax.pie(counts, autopct=lambda p: '{:.0f}'.format(p * sum(counts)/100) if p != 0 else '',
-               normalize=True)
+               normalize=sum(counts) != 0)
     else:
         # Matplotlib < 3.3.0
         ax.pie(counts, autopct=lambda p: '{:.0f}'.format(p * sum(counts)/100) if p != 0 else '')