|
@@ -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"
|
|
|
]
|
|
|
},
|
|
|
{
|