task finished

parent be360c7b
......@@ -9,10 +9,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
......@@ -29,14 +27,28 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"cell_type": "markdown",
"metadata": {},
"source": [
"I modified this computational document such that it uses a local copy of the data. If the local file does not exist, download the data and put them into the local file. And then read the local CSV file."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\""
"import os\n",
"import urllib.request\n",
"\n",
"local_file_for_this_task = \"local_data.csv\"\n",
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"\n",
"\n",
"if not os.path.exists(local_file_for_this_task):\n",
" urllib.request.urlretrieve(data_url, local_file_for_this_task)\n",
"else:\n",
" pass"
]
},
{
......@@ -63,11 +75,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'pd' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-7c69161e8105>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mraw_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlocal_file_for_this_task\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mskiprows\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mraw_data\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'pd' is not defined"
]
}
],
"source": [
"raw_data = pd.read_csv(data_url, skiprows=1)\n",
"raw_data = pd.read_csv(local_file_for_this_task, skiprows=1)\n",
"raw_data"
]
},
......@@ -365,7 +389,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.6.4"
}
},
"nbformat": 4,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment