diff --git a/module2/exo4/exercice.ipynb b/module2/exo4/exercice.ipynb index 0bbbe371b01e359e381e43239412d77bf53fb1fb..190259f378d73add62b149b9e13284d1556b6ea9 100644 --- a/module2/exo4/exercice.ipynb +++ b/module2/exo4/exercice.ipynb @@ -1,5 +1,56 @@ { - "cells": [], + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Statistique sur examen module 3A\n", + "Je m'intéresse à l'évolution des notes sur l'ensemble des année soit de 2001 à 2020 (Il manque les notes des années 2002 et 2003 introuvables???).\n", + "## Création de la base de donnée\n", + "### Lecture fichier CVS obtenue à partir des fichiers excel annuels" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: './module2/exo2/bases_notes.csv'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0mData\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[0;32m---> 17\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnomfichier\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnewline\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m''\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mcsvfile\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 18\u001b[0m \u001b[0mDataBrute\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcsv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcsvfile\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdelimiter\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 19\u001b[0m \u001b[0mData\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mrow\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mrow\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mDataBrute\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: './module2/exo2/bases_notes.csv'" + ] + } + ], + "source": [ + "# Récupération de données d'un ficier CSV\n", + "# Attention!!!!!!!\n", + "# Le separateur doit etre \";\" lors de la création du ficier CSV dans EXCEL\n", + "\n", + "###################################################\n", + "# Importation des modules utilisés\n", + "import csv #module pour lecture format CSV\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Nom du fichier à traiter\n", + "nomfichier=\"./module2/exo2/bases_notes.csv\"\n", + "\n", + "###################################################\n", + "# Lecture des données du fichier stockées alors dans Data\n", + "\n", + "Data=[]\n", + "with open(nomfichier, newline='') as csvfile:\n", + " DataBrute = csv.reader(csvfile, delimiter=';')\n", + " Data=[row for row in DataBrute]\n", + "print(Data)" + ] + } + ], "metadata": { "kernelspec": { "display_name": "Python 3", @@ -16,10 +67,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.3" + "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 } -