tentative2

parent de0767cf
......@@ -9,27 +9,16 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/home/jovyan/work/module3/exo1'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import isoweek\n",
"import os\n",
"os.getcwd()"
"import urllib.request\n"
]
},
{
......@@ -41,11 +30,22 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\""
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"\n",
"data_file=\"incidence_gripale.csv\"\n",
"if not os.path.exists(data_file):\n",
" urllib.request.urlretrieve(data_url, data_file)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Un nom de fichier est attribué aux données que nous voulons étudier. \n",
"Si ce fichier n'est pas disponible dans le répertoire courant, nous le téléchargeons directement depuis le site source afin d'en avoir une copie locale. Ainsi, le fichier sera toujours disponible pour étude et l'origine est conservée dans le document."
]
},
{
......@@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 25,
"metadata": {},
"outputs": [
{
......@@ -975,14 +975,13 @@
"[284 rows x 9 columns]"
]
},
"execution_count": 11,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#raw_data = pd.read_csv(data_url, skiprows=1)\n",
"raw_data = pd.read_csv(\"inc-25-PAY-ds2.csv\", skiprows=1)\n",
"raw_data"
]
},
......@@ -995,7 +994,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 26,
"metadata": {},
"outputs": [
{
......@@ -1041,7 +1040,7 @@
"Index: []"
]
},
"execution_count": 12,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1059,7 +1058,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 27,
"metadata": {},
"outputs": [
{
......@@ -1962,7 +1961,7 @@
"[284 rows x 9 columns]"
]
},
"execution_count": 13,
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
......@@ -1992,7 +1991,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
......@@ -2022,7 +2021,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
......@@ -2047,7 +2046,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
......@@ -2067,16 +2066,16 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f17c7d73978>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7f17c5742a20>"
]
},
"execution_count": 17,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
},
......@@ -2106,16 +2105,16 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f17c5c0afd0>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7f17c5c60f98>"
]
},
"execution_count": 18,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
},
......@@ -2166,7 +2165,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
......@@ -2186,7 +2185,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 34,
"metadata": {},
"outputs": [
{
......@@ -2196,7 +2195,7 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-20-9a471f5827a5>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m first_august_week[1:]):\n\u001b[1;32m 5\u001b[0m \u001b[0mone_year\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msorted_data\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'inc'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mweek1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mweek2\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[0;32m----> 6\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mone_year\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m52\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0myearly_incidence\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mone_year\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0myear\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mweek2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0myear\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-34-9a471f5827a5>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m first_august_week[1:]):\n\u001b[1;32m 5\u001b[0m \u001b[0mone_year\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msorted_data\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'inc'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mweek1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mweek2\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[0;32m----> 6\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mabs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mone_year\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m52\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0myearly_incidence\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mone_year\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0myear\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mweek2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0myear\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAssertionError\u001b[0m: "
]
}
......
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