Queer European MD passionate about IT
Browse Source

Add narrative to 'Extracting the Year' screen

Bruno @ Dataquest 3 years ago
parent
commit
bfd6eb2f3a
1 changed files with 15 additions and 2 deletions
  1. 15 2
      Mission610Solutions.ipynb

+ 15 - 2
Mission610Solutions.ipynb

@@ -133,14 +133,27 @@
     "## Extracting the Year"
    ]
   },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "In the code cell below, we iterate over `data` using the iterable variable `row` and:\n",
+    "    * With every occurrence of `row[0]`, we refer to the first entry of `row`, i.e., the date.\n",
+    "    * Thus, with `date = fetch_year(row[0])`, we're extracting the year out of the date in `row[0]` and assiging it to the variable `date`.\n",
+    "    * We then replace the value of `row[0]` with the year that we just extracted."
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": 6,
-   "metadata": {},
+   "metadata": {
+    "tags": []
+   },
    "outputs": [],
    "source": [
     "for row in data:\n",
-    "    row[0] = fetch_year(row[0])"
+    "    date = fetch_year(row[0])\n",
+    "    row[0] = date"
    ]
   },
   {