From f1ac7f81c4489b597b3373c20ba1b8f63134d662 Mon Sep 17 00:00:00 2001 From: 1071ae964b205fc96951cf272887f050 <1071ae964b205fc96951cf272887f050@app-learninglab.inria.fr> Date: Sun, 22 Jun 2025 14:15:18 +0000 Subject: [PATCH] a small update --- .../influenza-like-illness-analysis.ipynb | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/module3/exo1/influenza-like-illness-analysis.ipynb b/module3/exo1/influenza-like-illness-analysis.ipynb index 778cf9d..57b0f03 100644 --- a/module3/exo1/influenza-like-illness-analysis.ipynb +++ b/module3/exo1/influenza-like-illness-analysis.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -30,12 +30,12 @@ "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." + "I modified this computational document such that it uses a local file. If the local file exists, use it. If the local file does not exist, download the file from the website of the Réseau Sentinelles. " ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -43,7 +43,7 @@ "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", + "data_url = \"https://www.sentiweb.fr/datasets/all/inc-3-PAY.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", @@ -70,26 +70,14 @@ "| `geo_insee` | Identifier of the geographic area, from INSEE https://www.insee.fr |\n", "| `geo_name` | Geographic label of the area, corresponding to INSEE code. This label is not an id and is only provided for human reading |\n", "\n", - "The first line of the CSV file is a comment, which we ignore with `skip=1`." + "The first line of the CSV file is a comment, which we ignore with `skiprows=1`." ] }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "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\u001b[0m in \u001b[0;36m\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" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "raw_data = pd.read_csv(local_file_for_this_task, skiprows=1)\n", "raw_data" @@ -148,9 +136,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "def convert_week(year_and_week_int):\n", @@ -179,9 +165,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "sorted_data = data.set_index('period').sort_index()" @@ -276,9 +260,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "first_august_week = [pd.Period(pd.Timestamp(y, 8, 1), 'W')\n", @@ -298,9 +280,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [ "year = []\n", @@ -366,9 +346,21 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, "outputs": [], "source": [] } -- 2.18.1