Add option to not drop NA
This commit is contained in:
parent
f9c14e442b
commit
aaf4ee1863
7
wsgi.py
7
wsgi.py
@ -264,9 +264,10 @@ def convert_fig_to_svg(fig: plt.Figure) -> str:
|
|||||||
return imgdata.read()
|
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.astype({"Digitale Befragung": "Int32"})
|
||||||
df = df.dropna()
|
if dropna:
|
||||||
|
df = df.dropna()
|
||||||
with pd.option_context("display.max_rows", None):
|
with pd.option_context("display.max_rows", None):
|
||||||
table = df.to_html(
|
table = df.to_html(
|
||||||
index_names=False,
|
index_names=False,
|
||||||
@ -328,7 +329,7 @@ def tables():
|
|||||||
df = df.rename(columns={"Bundesland": "Landesbezirk"})
|
df = df.rename(columns={"Bundesland": "Landesbezirk"})
|
||||||
|
|
||||||
output_str = []
|
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())
|
output_str = _print_as_html(df, output_str, total=df_state['Digitale Befragung'].sum())
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user