diff --git a/module2/exo2/exercice.ipynb b/module2/exo2/exercice.ipynb index 252329f2dfa4163dff390d832f93de964711cbc4..ac93fd568cfc6f0ef4fec13443efa972bf88b4b3 100644 --- a/module2/exo2/exercice.ipynb +++ b/module2/exo2/exercice.ipynb @@ -108,7 +108,32 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import pandas as pd\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Création d’un mini journal de bord\n", + "data = {\n", + " \"Jour\": [\"Lundi\", \"Mardi\", \"Mercredi\", \"Jeudi\", \"Vendredi\"],\n", + " \"Heures_étude\": [2, 3.5, 4, 2.5, 3],\n", + " \"Thème\": [\"Python\", \"Jupyter\", \"Statistiques\", \"Graphiques\", \"Journal\"]\n", + "}\n", + "\n", + "df = pd.DataFrame(data)\n", + "\n", + "# Afficher le tableau\n", + "display(df)\n", + "\n", + "# Calcul de la moyenne d’heures d’étude\n", + "print(\"Moyenne des heures d’étude :\", round(df[\"Heures_étude\"].mean(), 2))\n", + "\n", + "# Affichage graphique\n", + "plt.plot(df[\"Jour\"], df[\"Heures_étude\"], marker='o', color='blue')\n", + "plt.title(\"Temps d’étude par jour\")\n", + "plt.xlabel(\"Jour\")\n", + "plt.ylabel(\"Heures\")\n", + "plt.show()" + ] } ], "metadata": {