From 4f1835c8f8064702a233fd3523faa7ff56a809b7 Mon Sep 17 00:00:00 2001 From: Felix Blanke Date: Tue, 19 Sep 2023 19:46:24 +0200 Subject: [PATCH] Format --- wsgi.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/wsgi.py b/wsgi.py index 7d9d8c4..e7ce794 100644 --- a/wsgi.py +++ b/wsgi.py @@ -291,11 +291,19 @@ def _print_as_html( dropna: bool = True, ) -> list[str]: df = df.astype({"Digitale Befragung": "Int32"}) - missing_df = df[["Digitale Befragung"]].isna().join(df[["Landesbezirk"]]).groupby("Landesbezirk").sum() + missing_df = ( + df[["Digitale Befragung"]] + .isna() + .join(df[["Landesbezirk"]]) + .groupby("Landesbezirk") + .sum() + ) total = df_state["Digitale Befragung"].sum() if df_state is not None else None if df_state is not None: - for idx, row in missing_df.loc[missing_df["Digitale Befragung"] == 1].iterrows(): + for idx, row in missing_df.loc[ + missing_df["Digitale Befragung"] == 1 + ].iterrows(): df_tmp = df.loc[df["Landesbezirk"] == idx] df_state_tmp = df_state.loc[df_state["Landesbezirk"] == idx] missing_idx = df_tmp.loc[df_tmp.isna().any(axis=1)].iloc[0].name @@ -334,7 +342,7 @@ def _print_as_html( ) if total and (diff := total - df["Digitale Befragung"].sum()): tfoot.append(" ") - num_missing = missing_df['Digitale Befragung'].sum() + num_missing = missing_df["Digitale Befragung"].sum() tfoot.append( f" Weitere Bezirke ({num_missing})" if num_missing @@ -385,9 +393,7 @@ def state_dashboard(state: str): output_str = [] output_str = _print_as_html(df_state, output_str, dropna=False) - output_str = _print_as_html( - df, output_str, df_state=df_state, dropna=False - ) + output_str = _print_as_html(df, output_str, df_state=df_state, dropna=False) return render_template( "base.html",