diff --git a/src/encord_active/app/common/components/annotator_statistics.py b/src/encord_active/app/common/components/annotator_statistics.py
index 5534e0738..4d34fca8a 100644
--- a/src/encord_active/app/common/components/annotator_statistics.py
+++ b/src/encord_active/app/common/components/annotator_statistics.py
@@ -13,15 +13,20 @@
def render_annotator_properties(df: DataFrame[MetricSchema]):
annotators = get_annotator_level_info(df)
if len(annotators) == 0:
+ st.warning("Found no annotators")
return
- left_col, right_col = st.columns([2, 2])
+ annotators_df = pd.DataFrame(list(annotators.values()))
+ total_annotations = annotators_df["total_annotations"].sum()
+ if not total_annotations:
+ st.warning("No annotations to show")
+ return
+ left_col, right_col = st.columns([2, 2])
# 1. Pie Chart
left_col.markdown(
"
Distribution of annotations", unsafe_allow_html=True
)
- annotators_df = pd.DataFrame(list(annotators.values()))
fig = px.pie(annotators_df, values="total_annotations", names="name", hover_data=["mean_score"])
@@ -32,14 +37,12 @@ def render_annotator_properties(df: DataFrame[MetricSchema]):
"Detailed annotator statistics", unsafe_allow_html=True
)
- total_annotations = annotators_df["total_annotations"].sum()
total_mean_score = (annotators_df["mean_score"] * annotators_df["total_annotations"]).sum() / total_annotations
info = AnnotatorInfo(name="all", total_annotations=total_annotations, mean_score=total_mean_score)
annotators_df = pd.concat([annotators_df, pd.Series(info).to_frame().T], ignore_index=True)
- deviation = (annotators_df["mean_score"] - total_mean_score) / total_mean_score * 100
- annotators_df["deviation"] = deviation
+ annotators_df["deviation"] = (annotators_df["mean_score"] - total_mean_score) / (total_mean_score or 1) * 100
right_col.dataframe(annotators_df.style.pipe(make_pretty), use_container_width=True)