From baf4f0c7005da3386b8f497c48022bb93484c8fe Mon Sep 17 00:00:00 2001
From: Pieter van der Hijden <pvdh@sofos.nl>
Date: Tue, 18 May 2021 15:14:43 +0200
Subject: [PATCH] Jupyter Notebook sdg-profiles-statistics updated

---
 .../sdg-profiles-statistics.ipynb             | 111 ++++++++++++------
 1 file changed, 77 insertions(+), 34 deletions(-)

diff --git a/aggregated-results/sdg-profiles-statistics.ipynb b/aggregated-results/sdg-profiles-statistics.ipynb
index 118bfe7..03a6842 100644
--- a/aggregated-results/sdg-profiles-statistics.ipynb
+++ b/aggregated-results/sdg-profiles-statistics.ipynb
@@ -90,7 +90,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -112,7 +112,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 30,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [
     {
@@ -121,7 +121,7 @@
        "(244, 29)"
       ]
      },
-     "execution_count": 30,
+     "execution_count": 4,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -166,28 +166,47 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 38,
+   "execution_count": 5,
    "metadata": {},
    "outputs": [
     {
-     "ename": "KeyError",
-     "evalue": "'Enter your SDG profile by ticking 2-4 SDGs'",
-     "output_type": "error",
-     "traceback": [
-      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
-      "\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m   3079\u001b[0m             \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3080\u001b[0;31m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcasted_key\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3081\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
-      "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
-      "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
-      "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
-      "\u001b[0;31mKeyError\u001b[0m: 'Enter your SDG profile by ticking 2-4 SDGs'",
-      "\nThe above exception was the direct cause of the following exception:\n",
-      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
-      "\u001b[0;32m<ipython-input-38-c721ca6096fb>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0;31m# Clean dataframe 'profiles'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0;31m# Delete verbose and superfluous columns 6-7\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mdel\u001b[0m \u001b[0mprofiles\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Enter your SDG profile by ticking 2-4 SDGs'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      4\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mprofiles\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'One more thing!'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m__delitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   3964\u001b[0m             \u001b[0;31m# there was no match, this call should raise the appropriate\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3965\u001b[0m             \u001b[0;31m# exception:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3966\u001b[0;31m             \u001b[0mloc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3967\u001b[0m             \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mgr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0midelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3968\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m   3080\u001b[0m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcasted_key\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3081\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3082\u001b[0;31m                 \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3083\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3084\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mtolerance\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
-      "\u001b[0;31mKeyError\u001b[0m: 'Enter your SDG profile by ticking 2-4 SDGs'"
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "<class 'pandas.core.frame.DataFrame'>\n",
+      "RangeIndex: 244 entries, 0 to 243\n",
+      "Data columns (total 27 columns):\n",
+      " #   Column                                      Non-Null Count  Dtype \n",
+      "---  ------                                      --------------  ----- \n",
+      " 0   slug                                        231 non-null    object\n",
+      " 1   Tijdstempel                                 238 non-null    object\n",
+      " 2   E-mailadres                                 238 non-null    object\n",
+      " 3   Your fullname                               238 non-null    object\n",
+      " 4   The name of your fab lab                    238 non-null    object\n",
+      " 5   Country of your fab lab                     237 non-null    object\n",
+      " 6   URL of your fab lab page on www.fablabs.io  238 non-null    object\n",
+      " 7   SDG 1                                       9 non-null      object\n",
+      " 8   SDG 2                                       13 non-null     object\n",
+      " 9   SDG 3                                       26 non-null     object\n",
+      " 10  SDG 4                                       190 non-null    object\n",
+      " 11  SDG 5                                       75 non-null     object\n",
+      " 12  SDG 6                                       14 non-null     object\n",
+      " 13  SDG 7                                       33 non-null     object\n",
+      " 14  SDG 8                                       68 non-null     object\n",
+      " 15  SDG 9                                       156 non-null    object\n",
+      " 16  SDG 10                                      24 non-null     object\n",
+      " 17  SDG 11                                      82 non-null     object\n",
+      " 18  SDG 12                                      102 non-null    object\n",
+      " 19  SDG 13                                      24 non-null     object\n",
+      " 20  SDG 14                                      7 non-null      object\n",
+      " 21  SDG 15                                      18 non-null     object\n",
+      " 22  SDG 16                                      2 non-null      object\n",
+      " 23  SDG 17                                      42 non-null     object\n",
+      " 24  summary                                     244 non-null    object\n",
+      " 25  status                                      244 non-null    object\n",
+      " 26  check                                       221 non-null    object\n",
+      "dtypes: object(27)\n",
+      "memory usage: 25.8+ KB\n"
      ]
     }
    ],
@@ -202,7 +221,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 39,
+   "execution_count": 6,
    "metadata": {},
    "outputs": [
     {
@@ -267,18 +286,43 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 33,
+   "execution_count": 7,
    "metadata": {},
    "outputs": [
     {
-     "data": {
-      "text/plain": [
-       "92"
-      ]
-     },
-     "execution_count": 33,
-     "metadata": {},
-     "output_type": "execute_result"
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "<class 'pandas.core.frame.DataFrame'>\n",
+      "Index: 2015 entries, ping to ZapLab\n",
+      "Data columns (total 22 columns):\n",
+      " #   Column           Non-Null Count  Dtype  \n",
+      "---  ------           --------------  -----  \n",
+      " 0   id               2015 non-null   int64  \n",
+      " 1   name             2015 non-null   object \n",
+      " 2   kind_name        2015 non-null   object \n",
+      " 3   parent_id        687 non-null    float64\n",
+      " 4   blurb            1968 non-null   object \n",
+      " 5   description      1986 non-null   object \n",
+      " 6   avatar_url       1655 non-null   object \n",
+      " 7   header_url       1322 non-null   object \n",
+      " 8   address_1        1987 non-null   object \n",
+      " 9   address_2        1985 non-null   object \n",
+      " 10  city             2015 non-null   object \n",
+      " 11  county           2015 non-null   object \n",
+      " 12  postal_code      2013 non-null   object \n",
+      " 13  country_code     2015 non-null   object \n",
+      " 14  latitude         1838 non-null   float64\n",
+      " 15  longitude        1838 non-null   float64\n",
+      " 16  address_notes    1986 non-null   object \n",
+      " 17  phone            1986 non-null   object \n",
+      " 18  email            1986 non-null   object \n",
+      " 19  capabilities     2015 non-null   object \n",
+      " 20  activity_status  1431 non-null   object \n",
+      " 21  links            2015 non-null   object \n",
+      "dtypes: float64(3), int64(1), object(18)\n",
+      "memory usage: 212.5+ KB\n"
+     ]
     }
    ],
    "source": [
@@ -319,7 +363,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 40,
+   "execution_count": 8,
    "metadata": {},
    "outputs": [
     {
@@ -386,7 +430,6 @@
     }
    ],
    "source": [
-    "#air_quality = pd.merge(air_quality, stations_coord, how=\"left\", on=\"location\")\n",
     "profiles = pd.merge(profiles, fablabs, how=\"left\", on=\"slug\")\n",
     "profiles.info()"
    ]
-- 
GitLab