no commit message

parent 805ac870
......@@ -9,16 +9,14 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import isoweek\n",
"import requests\n",
"import os"
"import isoweek"
]
},
{
......@@ -30,25 +28,32 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"file_path='incidence-PAY-3.csv'\n",
"if not os.path.isfile(file_path):\n",
" data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"\n",
" r = requests.get(data_url, allow_redirects=True)\n",
" with open(file_path, 'wb') as f:\n",
" f.write(r.content)"
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Je vérifie l'existence du fichier local *incidence-PAY-3.csv*.\n",
"S'écris le contenu de la variable r dans le fichier *incidence-PAY-3.csv*\n",
"Je récupère le contenu du fichier qui est stocké à l'URL *data_url*"
"Pour nous protéger contre une éventuelle disparition ou modification du serveur du Réseau Sentinelles, nous faisons une copie locale de ce jeux de données que nous préservons avec notre analyse. Il est inutile et même risquée de télécharger les données à chaque exécution, car dans le cas d'une panne nous pourrions remplacer nos données par un fichier défectueux. Pour cette raison, nous téléchargeons les données seulement si la copie locale n'existe pas."
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"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)"
]
},
{
......@@ -75,7 +80,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 46,
"metadata": {},
"outputs": [
{
......@@ -1040,13 +1045,13 @@
"[1888 rows x 10 columns]"
]
},
"execution_count": 29,
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"raw_data = pd.read_csv(file_path, skiprows=1)\n",
"raw_data = pd.read_csv(data_file, skiprows=1)\n",
"raw_data"
]
},
......@@ -1059,7 +1064,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 47,
"metadata": {},
"outputs": [
{
......@@ -1121,7 +1126,7 @@
"1651 FR France "
]
},
"execution_count": 30,
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1139,7 +1144,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 48,
"metadata": {},
"outputs": [
{
......@@ -2104,7 +2109,7 @@
"[1887 rows x 10 columns]"
]
},
"execution_count": 31,
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
......@@ -2134,7 +2139,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
......@@ -2164,7 +2169,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
......@@ -2189,7 +2194,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 51,
"metadata": {},
"outputs": [
{
......@@ -2217,16 +2222,16 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc4643eb390>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc464804ba8>"
]
},
"execution_count": 35,
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
},
......@@ -2256,16 +2261,16 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc4646f0400>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc464a19940>"
]
},
"execution_count": 36,
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
},
......@@ -2316,7 +2321,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 54,
"metadata": {},
"outputs": [],
"source": [
......@@ -2336,7 +2341,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 55,
"metadata": {},
"outputs": [],
"source": [
......@@ -2360,16 +2365,16 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc464be52b0>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc464413278>"
]
},
"execution_count": 39,
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
},
......@@ -2399,7 +2404,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 57,
"metadata": {},
"outputs": [
{
......@@ -2443,7 +2448,7 @@
"dtype: int64"
]
},
"execution_count": 40,
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
......@@ -2462,16 +2467,16 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc4644b3cc0>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fc464823518>"
]
},
"execution_count": 41,
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
},
......
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