Add option to not drop NA

This commit is contained in:
Felix Blanke 2023-09-01 14:46:58 +02:00
parent f9c14e442b
commit aaf4ee1863

View File

@ -264,9 +264,10 @@ def convert_fig_to_svg(fig: plt.Figure) -> str:
return imgdata.read()
def _print_as_html(df: pd.DataFrame, output_str: list[str], total: int | None = None) -> list[str]:
def _print_as_html(df: pd.DataFrame, output_str: list[str], total: int | None = None, dropna: bool = True) -> list[str]:
df = df.astype({"Digitale Befragung": "Int32"})
df = df.dropna()
if dropna:
df = df.dropna()
with pd.option_context("display.max_rows", None):
table = df.to_html(
index_names=False,
@ -328,7 +329,7 @@ def tables():
df = df.rename(columns={"Bundesland": "Landesbezirk"})
output_str = []
output_str = _print_as_html(df_state, output_str)
output_str = _print_as_html(df_state, output_str, dropna=False)
output_str = _print_as_html(df, output_str, total=df_state['Digitale Befragung'].sum())
return render_template(