diff --git a/explorer/civsoc.py b/explorer/civsoc.py index 93d2ece..2eca001 100644 --- a/explorer/civsoc.py +++ b/explorer/civsoc.py @@ -1224,9 +1224,9 @@ def callback(): ############################################################################### -df.to_pickle("./data/civsoc.pkl") -df.to_excel("./data/civsoc.xlsx") -df.to_csv("./data/civsoc.csv") +# df.to_pickle("./data/civsoc.pkl") +# df.to_excel("./data/civsoc.xlsx") +# df.to_csv("./data/civsoc.csv") ############################################################################### @@ -1265,7 +1265,21 @@ def callback(): col1.metric("Civil Society Representatives", len(df[filter].index)) col2.metric( "Cumulative years spent working on SBIA", - int(df[filter]["CSexpertise1"].sum()), + df[filter]["CSexpertise1"].sum(), + ) + + col1, col2 = st.columns(2) + col1.metric( + "Average years spent working on SBIA†", + "%.1f" % df[filter]["CSexpertise1"].mean(), + ) + col2.metric( + "Average Number of FOI requests sent in the past 5 years", + int(df[filter]["CSfoi2"].mean()), + ) + + st.caption( + "†For the calculation of the mean, only valid numerical answers were counted. This is why the number might differ from the number one gets when simply dividing e.g. the cumulative years spent working on SBIA by the overall number of respondents (including those who haven't specified their experience in years)." ) st.write("### Country `[country]`") diff --git a/explorer/media.py b/explorer/media.py index 500a04c..19dea6e 100644 --- a/explorer/media.py +++ b/explorer/media.py @@ -1075,7 +1075,31 @@ def callback(): col1.metric("Media representatives", len(df[filter].index)) col2.metric( "Cumulative years spent working on SBIA", - int(df[filter]["MSexpertise1"].sum()), + df[filter]["MSexpertise1"].sum(), + ) + + col1, col2 = st.columns(2) + col1.metric( + "Average years spent working on SBIA†", + "%.1f" % df[filter]["MSexpertise1"].mean(), + ) + col2.metric( + "Average Number of FOI requests sent in the past 5 years", + int(df[filter]["MSfoi2"].mean()), + ) + + col1, col2 = st.columns(2) + col1.metric( + "Articles written on SBIA in the last year", + "%.1f" % df[filter]["MSsoc2"].sum(), + ) + col2.metric( + "Average Articles written on SBIA in the last year", + "%.1f" % df[filter]["MSsoc2"].mean(), + ) + + st.caption( + "†For the calculation of the mean, only valid numerical answers were counted. This is why the number might differ from the number one gets when simply dividing e.g. the cumulative years spent working on SBIA by the overall number of respondents (including those who haven't specified their experience in years)." ) st.write("### Country `[country]`") diff --git a/explorer/merged.py b/explorer/merged.py index 9433b3b..25a53b2 100644 --- a/explorer/merged.py +++ b/explorer/merged.py @@ -1000,6 +1000,16 @@ def callback(): int(df[filter]["expertise1"].sum()), ) + col1, col2 = st.columns(2) + col1.metric( + "Average years spent working on SBIA†", + "%.1f" % df[filter]["expertise1"].mean(), + ) + col2.metric( + "Average Number of FOI requests sent in the past 5 years", + int(df[filter]["foi2"].mean()), + ) + col1, col2 = st.columns(2) col1.metric( "Media representatives", @@ -1010,6 +1020,10 @@ def callback(): len(df[filter & (df.surveytype == "Civil Society Scrutiny")].index), ) + st.caption( + "†For the calculation of the mean, only valid numerical answers were counted. This is why the number might differ from the number one gets when simply dividing e.g. the cumulative years spent working on SBIA by the overall number of respondents (including those who haven't specified their experience in years)." + ) + st.write("### Country `[country]`") country_counts = df[filter]["country"].value_counts() st.plotly_chart(