From 4bc5fb5783ffccdfadced01a31a548978fada9ec Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 11 Nov 2021 21:43:10 +0000 Subject: [PATCH] Fix ZeroDivisionError in qiskit_backend_overview (#7260) --- qiskit/tools/jupyter/backend_overview.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qiskit/tools/jupyter/backend_overview.py b/qiskit/tools/jupyter/backend_overview.py index 876b9fc9a5c3..33053c35ed65 100644 --- a/qiskit/tools/jupyter/backend_overview.py +++ b/qiskit/tools/jupyter/backend_overview.py @@ -199,7 +199,8 @@ def backend_widget(backend): if param["value"] != 1.0: sum_cx_err += param["value"] num_cx += 1 - avg_cx_err = round(sum_cx_err / (num_cx), 4) + if num_cx > 0: + avg_cx_err = round(sum_cx_err / num_cx, 4) cx_widget = widgets.HTML(value=f"
{avg_cx_err}
", layout=widgets.Layout())