Format
This commit is contained in:
parent
32bd83f054
commit
4f1835c8f8
18
wsgi.py
18
wsgi.py
@ -291,11 +291,19 @@ def _print_as_html(
|
|||||||
dropna: bool = True,
|
dropna: bool = True,
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
df = df.astype({"Digitale Befragung": "Int32"})
|
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
|
total = df_state["Digitale Befragung"].sum() if df_state is not None else None
|
||||||
|
|
||||||
if df_state is not 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_tmp = df.loc[df["Landesbezirk"] == idx]
|
||||||
df_state_tmp = df_state.loc[df_state["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
|
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()):
|
if total and (diff := total - df["Digitale Befragung"].sum()):
|
||||||
tfoot.append(" <tr>")
|
tfoot.append(" <tr>")
|
||||||
num_missing = missing_df['Digitale Befragung'].sum()
|
num_missing = missing_df["Digitale Befragung"].sum()
|
||||||
tfoot.append(
|
tfoot.append(
|
||||||
f" <td>Weitere Bezirke ({num_missing})</td>"
|
f" <td>Weitere Bezirke ({num_missing})</td>"
|
||||||
if num_missing
|
if num_missing
|
||||||
@ -385,9 +393,7 @@ def state_dashboard(state: str):
|
|||||||
|
|
||||||
output_str = []
|
output_str = []
|
||||||
output_str = _print_as_html(df_state, output_str, dropna=False)
|
output_str = _print_as_html(df_state, output_str, dropna=False)
|
||||||
output_str = _print_as_html(
|
output_str = _print_as_html(df, output_str, df_state=df_state, dropna=False)
|
||||||
df, output_str, df_state=df_state, dropna=False
|
|
||||||
)
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"base.html",
|
"base.html",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user