From 29384c315872347a6d6f2d991a846d1bd2e72ac7 Mon Sep 17 00:00:00 2001 From: c4489d0ac1b4dc0c3726033b10607283 Date: Tue, 7 Jun 2022 09:29:30 +0000 Subject: [PATCH] url -> local --- .../influenza-like-illness-analysis.ipynb | 39 +++++++++++++------ ...cidence-PAY-3.csv => syndrome-grippal.csv} | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) rename module3/exo1/{incidence-PAY-3.csv => syndrome-grippal.csv} (99%) diff --git a/module3/exo1/influenza-like-illness-analysis.ipynb b/module3/exo1/influenza-like-illness-analysis.ipynb index de71882..54cd62c 100644 --- a/module3/exo1/influenza-like-illness-analysis.ipynb +++ b/module3/exo1/influenza-like-illness-analysis.ipynb @@ -28,10 +28,8 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, + "execution_count": 15, + "metadata": {}, "outputs": [], "source": [ "data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"" @@ -63,29 +61,36 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Data is stored in the local dir exo1, set the local path" + "Download data from url and save to the local dir (check if not exist)" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ - "local_path = 'incidence-PAY-3.csv'" + "data_file = \"syndrome-grippal.csv\"\n", + "\n", + "import os\n", + "import urllib.request\n", + "if not os.path.exists(data_file):\n", + " urllib.request.urlretrieve(data_url, data_file)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now replace the data_url by the local_path" + "Now replace the data_url by the data_file " ] }, { "cell_type": "code", - "execution_count": 13, - "metadata": {}, + "execution_count": 20, + "metadata": { + "scrolled": true + }, "outputs": [ { "data": { @@ -1049,16 +1054,26 @@ "[1961 rows x 10 columns]" ] }, - "execution_count": 13, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "raw_data = pd.read_csv(local_path, skiprows=1)\n", + "\n", + "raw_data = pd.read_csv(data_file, skiprows=1)\n", "raw_data" ] }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "local_path = 'incidence-PAY-3.csv'" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/module3/exo1/incidence-PAY-3.csv b/module3/exo1/syndrome-grippal.csv similarity index 99% rename from module3/exo1/incidence-PAY-3.csv rename to module3/exo1/syndrome-grippal.csv index db96e0f..3c95840 100644 --- a/module3/exo1/incidence-PAY-3.csv +++ b/module3/exo1/syndrome-grippal.csv @@ -1,4 +1,4 @@ -# @source="réseau Sentinelles, INSERM, Sorbonne Université, http://www.sentiweb.fr", @meta={"period":[198444,202221],"geo":["PAY","1"],"geo_ref":"insee","indicator":"3","type":"all","conf_int":true,"compact":false}, @date=2022-06-07T09:37:54+02:00 +# @source="réseau Sentinelles, INSERM, Sorbonne Université, http://www.sentiweb.fr", @meta={"period":[198444,202221],"geo":["PAY","1"],"geo_ref":"insee","indicator":"3","type":"all","conf_int":true,"compact":false}, @date=2022-06-07T10:39:55+02:00 week,indicator,inc,inc_low,inc_up,inc100,inc100_low,inc100_up,geo_insee,geo_name 202221,3,17538,12255,22821,26,18,34,FR,France 202220,3,20413,16271,24555,31,25,37,FR,France -- 2.18.1