diff --git a/wsgi.py b/wsgi.py index fc9a356..aaa2dfb 100644 --- a/wsgi.py +++ b/wsgi.py @@ -292,8 +292,16 @@ def _print_as_html( ) -> list[str]: df = df.astype({"Digitale Befragung": "Int32"}) num_missing = (df[df.isna().any(axis=1)]["Landesbezirk"] != "Hessen").sum() + if num_missing == 1: + # infer value from total + df_tmp = df.loc[df["Landesbezirk"] != "Hessen"] + idx = df_tmp.loc[df_tmp.isna().any(axis=1)].iloc[0].name + df["Digitale Befragung"].loc[idx] = ( + total - df.dropna()["Digitale Befragung"].sum() + ) if dropna: df = df.dropna() + with pd.option_context("display.max_rows", None): table = df.to_html( index_names=False,