From addc218edbf637b92e57183082da8b6af91cc559 Mon Sep 17 00:00:00 2001 From: 451defe1a1074031578ff629b9291801 <451defe1a1074031578ff629b9291801@app-learninglab.inria.fr> Date: Wed, 16 Dec 2020 17:57:21 +0000 Subject: [PATCH] Ajout commentaire --- module3/exo1/analyse-syndrome-grippal.ipynb | 110 ++++++++++++++++++-- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/module3/exo1/analyse-syndrome-grippal.ipynb b/module3/exo1/analyse-syndrome-grippal.ipynb index 7c01d7e..27bf3b4 100644 --- a/module3/exo1/analyse-syndrome-grippal.ipynb +++ b/module3/exo1/analyse-syndrome-grippal.ipynb @@ -57,17 +57,48 @@ "La première ligne du fichier CSV est un commentaire, que nous ignorons en précisant `skiprows=1`." ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Changement du code* : les données ont été écrites au format csv. Le code vérifie que les données sont toujours présentes et les lit en priorité. Sinon, il va les chercher sur l'URL." + ] + }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "existe\n" + ] + }, + { + "data": { + "text/plain": [ + "1883" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "raw_data = pd.read_csv(data_url, skiprows=1)\n", + "#raw_data = pd.read_csv(data_url, skiprows=1)\n", "#raw_data\n", - "raw_data.to_csv('incidence-PAY-3.csv')\n", - "#with open('incidence-PAY-3.csv', 'w') as file:\n", - "# csv.writer(file)" + "#raw_data.to_csv('incidence-PAY-3.csv')\n", + "import os\n", + "if os.path.isfile('incidence-PAY-3.csv'):\n", + " raw_data = pd.read_csv('incidence-PAY-3.csv', skiprows = 1)\n", + " print('existe')\n", + "else:\n", + " print(\"n'existe pas\")\n", + " raw_data = pd.read_csv(data_url, skiprows = 1)\n", + "len(raw_data)" ] }, { @@ -79,9 +110,72 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
020204931327310162.016384.02015.025.0FRFrance
1646164719891930NaNNaN0NaNNaNFRFrance
\n", + "
" + ], + "text/plain": [ + " 0 202049 3 13273 10162.0 16384.0 20 15.0 25.0 FR France\n", + "1646 1647 198919 3 0 NaN NaN 0 NaN NaN FR France" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "raw_data[raw_data.isnull().any(axis=1)]" ] -- 2.18.1