From c42ad7711f932225fe2b07a27044d779a1225007 Mon Sep 17 00:00:00 2001 From: linozen Date: Tue, 24 Aug 2021 14:20:34 +0200 Subject: [PATCH] minor changes --- explorer/merged.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/explorer/merged.py b/explorer/merged.py index dfe70bc..bceda16 100644 --- a/explorer/merged.py +++ b/explorer/merged.py @@ -987,13 +987,16 @@ def get_merged_ms_df(): "### Respondents working more than 5 days on surveillance by intelligence agencies? `[hr2]`" ) df["hr2_more_than_five"] = np.where(df["hr2"] > 5, True, False) -df["hr2_more_than_five"] = pd.to_numeric(df["hr2_more_than_five"], errors="coerce") +df["hr2_more_than_five"] = df["hr2_more_than_five"].replace( + {True: ">5 days", False: "5 days or less"} +) hr2_more_than_five_counts = df[filter]["hr2_more_than_five"].value_counts() +print(hr2_more_than_five_counts) st.plotly_chart( render_pie_chart( hr2_more_than_five_counts, values=hr2_more_than_five_counts, - names=["<5 days", ">5 days"], + names=hr2_more_than_five_counts.index, color=hr2_more_than_five_counts.index, ) ) @@ -1481,7 +1484,7 @@ def get_merged_ms_df(): ) ) -st.write("### If you selected ‘other’, please specify `[protectleg2no]`") +st.write("### If you selected ‘no’, please specify `[protectleg2no]`") for i in df[filter]["protectleg2no"].to_list(): if type(i) != float: st.write("- " + i)