diff --git a/MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb b/MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb index 764b59c986..2f4163b573 100644 --- a/MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb +++ b/MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb @@ -5,10 +5,10 @@ "id": "3835c398", "metadata": { "papermill": { - "duration": 0.003976, - "end_time": "2026-09-23T14:35:00.440981+00:00", + "duration": 0.004225, + "end_time": "2026-09-29T21:23:05.614987+00:00", "exception": false, - "start_time": "2026-09-23T14:35:00.437005+00:00", + "start_time": "2026-09-29T21:23:05.610762+00:00", "status": "completed" }, "tags": [] @@ -40,10 +40,10 @@ "id": "9c3e9efc", "metadata": { "papermill": { - "duration": 0.003442, - "end_time": "2026-09-23T14:35:00.448219+00:00", + "duration": 0.002983, + "end_time": "2026-09-29T21:23:05.622660+00:00", "exception": false, - "start_time": "2026-09-23T14:35:00.444777+00:00", + "start_time": "2026-09-29T21:23:05.619677+00:00", "status": "completed" }, "tags": [] @@ -57,10 +57,10 @@ "id": "72514776", "metadata": { "papermill": { - "duration": 0.003445, - "end_time": "2026-09-23T14:35:00.455401+00:00", + "duration": 0.00291, + "end_time": "2026-09-29T21:23:05.628720+00:00", "exception": false, - "start_time": "2026-09-23T14:35:00.451956+00:00", + "start_time": "2026-09-29T21:23:05.625810+00:00", "status": "completed" }, "tags": [] @@ -75,16 +75,16 @@ "id": "8347e543", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:00.466156Z", - "iopub.status.busy": "2026-09-23T14:35:00.465784Z", - "iopub.status.idle": "2026-09-23T14:35:05.291577Z", - "shell.execute_reply": "2026-09-23T14:35:05.288369Z" + "iopub.execute_input": "2026-09-29T21:23:05.636138Z", + "iopub.status.busy": "2026-09-29T21:23:05.635864Z", + "iopub.status.idle": "2026-09-29T21:23:09.057420Z", + "shell.execute_reply": "2026-09-29T21:23:09.056634Z" }, "papermill": { - "duration": 4.833307, - "end_time": "2026-09-23T14:35:05.292987+00:00", + "duration": 3.426748, + "end_time": "2026-09-29T21:23:09.058380+00:00", "exception": false, - "start_time": "2026-09-23T14:35:00.459680+00:00", + "start_time": "2026-09-29T21:23:05.631632+00:00", "status": "completed" }, "tags": [] @@ -122,10 +122,10 @@ "id": "d2a3ec9d", "metadata": { "papermill": { - "duration": 0.003984, - "end_time": "2026-09-23T14:35:05.301218+00:00", + "duration": 0.003067, + "end_time": "2026-09-29T21:23:09.064823+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.297234+00:00", + "start_time": "2026-09-29T21:23:09.061756+00:00", "status": "completed" }, "tags": [] @@ -140,16 +140,16 @@ "id": "7fd4a313", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:05.311774Z", - "iopub.status.busy": "2026-09-23T14:35:05.311276Z", - "iopub.status.idle": "2026-09-23T14:35:05.349767Z", - "shell.execute_reply": "2026-09-23T14:35:05.348571Z" + "iopub.execute_input": "2026-09-29T21:23:09.073028Z", + "iopub.status.busy": "2026-09-29T21:23:09.072691Z", + "iopub.status.idle": "2026-09-29T21:23:09.121058Z", + "shell.execute_reply": "2026-09-29T21:23:09.119868Z" }, "papermill": { - "duration": 0.045424, - "end_time": "2026-09-23T14:35:05.351010+00:00", + "duration": 0.053744, + "end_time": "2026-09-29T21:23:09.121808+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.305586+00:00", + "start_time": "2026-09-29T21:23:09.068064+00:00", "status": "completed" }, "tags": [] @@ -284,10 +284,10 @@ "id": "3552234a", "metadata": { "papermill": { - "duration": 0.00442, - "end_time": "2026-09-23T14:35:05.360650+00:00", + "duration": 0.004346, + "end_time": "2026-09-29T21:23:09.130386+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.356230+00:00", + "start_time": "2026-09-29T21:23:09.126040+00:00", "status": "completed" }, "tags": [] @@ -301,10 +301,10 @@ "id": "746c8675", "metadata": { "papermill": { - "duration": 0.004964, - "end_time": "2026-09-23T14:35:05.369365+00:00", + "duration": 0.004115, + "end_time": "2026-09-29T21:23:09.137959+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.364401+00:00", + "start_time": "2026-09-29T21:23:09.133844+00:00", "status": "completed" }, "tags": [] @@ -321,16 +321,16 @@ "id": "f7185256", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:05.381166Z", - "iopub.status.busy": "2026-09-23T14:35:05.380770Z", - "iopub.status.idle": "2026-09-23T14:35:05.850214Z", - "shell.execute_reply": "2026-09-23T14:35:05.848904Z" + "iopub.execute_input": "2026-09-29T21:23:09.146383Z", + "iopub.status.busy": "2026-09-29T21:23:09.145981Z", + "iopub.status.idle": "2026-09-29T21:23:09.404086Z", + "shell.execute_reply": "2026-09-29T21:23:09.403049Z" }, "papermill": { - "duration": 0.478135, - "end_time": "2026-09-23T14:35:05.852616+00:00", + "duration": 0.26375, + "end_time": "2026-09-29T21:23:09.404928+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.374481+00:00", + "start_time": "2026-09-29T21:23:09.141178+00:00", "status": "completed" }, "tags": [] @@ -360,10 +360,10 @@ "id": "658dc0fa", "metadata": { "papermill": { - "duration": 0.004798, - "end_time": "2026-09-23T14:35:05.862235+00:00", + "duration": 0.003403, + "end_time": "2026-09-29T21:23:09.411896+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.857437+00:00", + "start_time": "2026-09-29T21:23:09.408493+00:00", "status": "completed" }, "tags": [] @@ -378,16 +378,16 @@ "id": "f0f55774", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:05.873896Z", - "iopub.status.busy": "2026-09-23T14:35:05.873243Z", - "iopub.status.idle": "2026-09-23T14:35:10.753345Z", - "shell.execute_reply": "2026-09-23T14:35:10.752188Z" + "iopub.execute_input": "2026-09-29T21:23:09.420050Z", + "iopub.status.busy": "2026-09-29T21:23:09.419779Z", + "iopub.status.idle": "2026-09-29T21:23:13.949612Z", + "shell.execute_reply": "2026-09-29T21:23:13.948524Z" }, "papermill": { - "duration": 4.887363, - "end_time": "2026-09-23T14:35:10.754379+00:00", + "duration": 4.535266, + "end_time": "2026-09-29T21:23:13.950369+00:00", "exception": false, - "start_time": "2026-09-23T14:35:05.867016+00:00", + "start_time": "2026-09-29T21:23:09.415103+00:00", "status": "completed" }, "tags": [] @@ -443,10 +443,10 @@ "id": "74ffd8b1", "metadata": { "papermill": { - "duration": 0.004646, - "end_time": "2026-09-23T14:35:10.765435+00:00", + "duration": 0.003176, + "end_time": "2026-09-29T21:23:13.957329+00:00", "exception": false, - "start_time": "2026-09-23T14:35:10.760789+00:00", + "start_time": "2026-09-29T21:23:13.954153+00:00", "status": "completed" }, "tags": [] @@ -463,16 +463,16 @@ "id": "cb22fc5e", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:10.776849Z", - "iopub.status.busy": "2026-09-23T14:35:10.776504Z", - "iopub.status.idle": "2026-09-23T14:35:14.137840Z", - "shell.execute_reply": "2026-09-23T14:35:14.136541Z" + "iopub.execute_input": "2026-09-29T21:23:13.966250Z", + "iopub.status.busy": "2026-09-29T21:23:13.965804Z", + "iopub.status.idle": "2026-09-29T21:23:16.955601Z", + "shell.execute_reply": "2026-09-29T21:23:16.954734Z" }, "papermill": { - "duration": 3.36976, - "end_time": "2026-09-23T14:35:14.139558+00:00", + "duration": 2.995706, + "end_time": "2026-09-29T21:23:16.956389+00:00", "exception": false, - "start_time": "2026-09-23T14:35:10.769798+00:00", + "start_time": "2026-09-29T21:23:13.960683+00:00", "status": "completed" }, "tags": [] @@ -528,10 +528,10 @@ "id": "04764bb6", "metadata": { "papermill": { - "duration": 0.004536, - "end_time": "2026-09-23T14:35:14.149625+00:00", + "duration": 0.003529, + "end_time": "2026-09-29T21:23:16.963564+00:00", "exception": false, - "start_time": "2026-09-23T14:35:14.145089+00:00", + "start_time": "2026-09-29T21:23:16.960035+00:00", "status": "completed" }, "tags": [] @@ -539,7 +539,7 @@ "source": [ "### Question d'exploration : Valeurs uniques\n", "\n", - "Explorons maintenant les catégories de produits disponibles. Cette question teste la capacite de l'agent a identifier et utiliser les méthodes appropriees de Pandas (comme `.unique()` ou `.nunique()`).\n" + "Explorons maintenant les dates des transactions. Cette question teste la capacite de l'agent a identifier et utiliser les méthodes appropriees de Pandas (comme `.unique()` ou `.nunique()`).\n" ] }, { @@ -548,16 +548,16 @@ "id": "f9fde191", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:14.160511Z", - "iopub.status.busy": "2026-09-23T14:35:14.159929Z", - "iopub.status.idle": "2026-09-23T14:35:19.003163Z", - "shell.execute_reply": "2026-09-23T14:35:19.001902Z" + "iopub.execute_input": "2026-09-29T21:23:16.971367Z", + "iopub.status.busy": "2026-09-29T21:23:16.971004Z", + "iopub.status.idle": "2026-09-29T21:23:21.613929Z", + "shell.execute_reply": "2026-09-29T21:23:21.612902Z" }, "papermill": { - "duration": 4.866628, - "end_time": "2026-09-23T14:35:19.020301+00:00", + "duration": 4.647893, + "end_time": "2026-09-29T21:23:21.614622+00:00", "exception": false, - "start_time": "2026-09-23T14:35:14.153673+00:00", + "start_time": "2026-09-29T21:23:16.966729+00:00", "status": "completed" }, "tags": [] @@ -576,25 +576,18 @@ "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32;1m\u001b[1;3mTu peux utiliser pandas. Exemple :\n", - "\n", - "Code simple (retourne un tableau numpy) :\n", - "```python\n", - "df['categorie'].unique()\n", - "```\n", - "\n", - "Pour obtenir une liste Python sans valeurs nulles :\n", - "```python\n", - "df['categorie'].dropna().unique().tolist()\n", - "```\n", + "\u001b[32;1m\u001b[1;3m\n", + "Invoking: `python_repl_ast` with `{'query': \"import pandas as pd\\npd.to_datetime(df['date']).dt.date.nunique()\"}`\n", "\n", - "Ou, pour une liste triée et sans doublons :\n", - "```python\n", - "sorted(df['categorie'].dropna().unique().tolist())\n", - "```\n", "\n", - "D'après l'extrait affiché, les catégories uniques sont :\n", - "['Electronique', 'Livre', 'Maison']\u001b[0m\n", + "\u001b[0m\u001b[36;1m\u001b[1;3m4\u001b[0m" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[32;1m\u001b[1;3mIl y a 4 dates uniques dans le jeu de données.\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n" ] @@ -602,8 +595,8 @@ { "data": { "text/plain": [ - "{'input': 'Liste les catégories de produits uniques.',\n", - " 'output': \"Tu peux utiliser pandas. Exemple :\\n\\nCode simple (retourne un tableau numpy) :\\n```python\\ndf['categorie'].unique()\\n```\\n\\nPour obtenir une liste Python sans valeurs nulles :\\n```python\\ndf['categorie'].dropna().unique().tolist()\\n```\\n\\nOu, pour une liste triée et sans doublons :\\n```python\\nsorted(df['categorie'].dropna().unique().tolist())\\n```\\n\\nD'après l'extrait affiché, les catégories uniques sont :\\n['Electronique', 'Livre', 'Maison']\"}" + "{'input': 'Combien y a-t-il de dates uniques dans les données ?',\n", + " 'output': 'Il y a 4 dates uniques dans le jeu de données.'}" ] }, "execution_count": 6, @@ -612,7 +605,7 @@ } ], "source": [ - "agent_executor.invoke({\"input\": \"Liste les catégories de produits uniques.\"})" + "agent_executor.invoke({\"input\": \"Combien y a-t-il de dates uniques dans les données ?\"})" ] }, { @@ -620,10 +613,10 @@ "id": "e7f5796a", "metadata": { "papermill": { - "duration": 0.009957, - "end_time": "2026-09-23T14:35:19.035319+00:00", + "duration": 0.004002, + "end_time": "2026-09-29T21:23:21.622518+00:00", "exception": false, - "start_time": "2026-09-23T14:35:19.025362+00:00", + "start_time": "2026-09-29T21:23:21.618516+00:00", "status": "completed" }, "tags": [] @@ -640,16 +633,16 @@ "id": "4ad883c6", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:19.050527Z", - "iopub.status.busy": "2026-09-23T14:35:19.050054Z", - "iopub.status.idle": "2026-09-23T14:35:26.329277Z", - "shell.execute_reply": "2026-09-23T14:35:26.327591Z" + "iopub.execute_input": "2026-09-29T21:23:21.631997Z", + "iopub.status.busy": "2026-09-29T21:23:21.631588Z", + "iopub.status.idle": "2026-09-29T21:23:25.974488Z", + "shell.execute_reply": "2026-09-29T21:23:25.973492Z" }, "papermill": { - "duration": 7.289901, - "end_time": "2026-09-23T14:35:26.330263+00:00", + "duration": 4.348892, + "end_time": "2026-09-29T21:23:25.975341+00:00", "exception": false, - "start_time": "2026-09-23T14:35:19.040362+00:00", + "start_time": "2026-09-29T21:23:21.626449+00:00", "status": "completed" }, "tags": [] @@ -669,11 +662,13 @@ "output_type": "stream", "text": [ "\u001b[32;1m\u001b[1;3m\n", - "Invoking: `python_repl_ast` with `{'query': \"result = df.groupby('categorie')['chiffre_affaires'].sum().sort_values(ascending=False)\\nresult.head(1)\"}`\n", + "Invoking: `python_repl_ast` with `{'query': \"df.groupby('categorie')['chiffre_affaires'].sum().sort_values(ascending=False)\"}`\n", "\n", "\n", "\u001b[0m\u001b[36;1m\u001b[1;3mcategorie\n", "Electronique 1440.0\n", + "Livre 248.0\n", + "Maison 151.8\n", "Name: chiffre_affaires, dtype: float64\u001b[0m" ] }, @@ -681,12 +676,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32;1m\u001b[1;3mLa catégorie la plus rentable est \"Electronique\" — elle a généré 1440.0 en chiffre d'affaires.\n", - "\n", - "Commande utilisée :\n", - "df.groupby('categorie')['chiffre_affaires'].sum().sort_values(ascending=False)\n", - "\n", - "Voulez-vous le détail complet par catégorie ?\u001b[0m\n", + "\u001b[32;1m\u001b[1;3mLa catégorie qui a généré le plus de chiffre d'affaires est \"Electronique\" — total = 1440.0 (unités monétaires).\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n" ] @@ -695,7 +685,7 @@ "data": { "text/plain": [ "{'input': \"Quelle est la catégorie qui a généré le plus de chiffre d'affaires ?\",\n", - " 'output': 'La catégorie la plus rentable est \"Electronique\" — elle a généré 1440.0 en chiffre d\\'affaires.\\n\\nCommande utilisée :\\ndf.groupby(\\'categorie\\')[\\'chiffre_affaires\\'].sum().sort_values(ascending=False)\\n\\nVoulez-vous le détail complet par catégorie ?'}" + " 'output': 'La catégorie qui a généré le plus de chiffre d\\'affaires est \"Electronique\" — total = 1440.0 (unités monétaires).'}" ] }, "execution_count": 7, @@ -712,10 +702,10 @@ "id": "adef963a", "metadata": { "papermill": { - "duration": 0.005838, - "end_time": "2026-09-23T14:35:26.342346+00:00", + "duration": 0.003876, + "end_time": "2026-09-29T21:23:25.983403+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.336508+00:00", + "start_time": "2026-09-29T21:23:25.979527+00:00", "status": "completed" }, "tags": [] @@ -741,16 +731,16 @@ "id": "f98c128d", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:26.356944Z", - "iopub.status.busy": "2026-09-23T14:35:26.356523Z", - "iopub.status.idle": "2026-09-23T14:35:26.367049Z", - "shell.execute_reply": "2026-09-23T14:35:26.364927Z" + "iopub.execute_input": "2026-09-29T21:23:25.994171Z", + "iopub.status.busy": "2026-09-29T21:23:25.993860Z", + "iopub.status.idle": "2026-09-29T21:23:25.998576Z", + "shell.execute_reply": "2026-09-29T21:23:25.997609Z" }, "papermill": { - "duration": 0.02057, - "end_time": "2026-09-23T14:35:26.368708+00:00", + "duration": 0.010582, + "end_time": "2026-09-29T21:23:25.999320+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.348138+00:00", + "start_time": "2026-09-29T21:23:25.988738+00:00", "status": "completed" }, "tags": [] @@ -786,10 +776,10 @@ "id": "4b976756", "metadata": { "papermill": { - "duration": 0.005807, - "end_time": "2026-09-23T14:35:26.381786+00:00", + "duration": 0.004324, + "end_time": "2026-09-29T21:23:26.007561+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.375979+00:00", + "start_time": "2026-09-29T21:23:26.003237+00:00", "status": "completed" }, "tags": [] @@ -814,16 +804,16 @@ "id": "0aecdc00", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:26.410475Z", - "iopub.status.busy": "2026-09-23T14:35:26.409936Z", - "iopub.status.idle": "2026-09-23T14:35:26.418683Z", - "shell.execute_reply": "2026-09-23T14:35:26.417310Z" + "iopub.execute_input": "2026-09-29T21:23:26.016307Z", + "iopub.status.busy": "2026-09-29T21:23:26.016068Z", + "iopub.status.idle": "2026-09-29T21:23:26.020450Z", + "shell.execute_reply": "2026-09-29T21:23:26.019700Z" }, "papermill": { - "duration": 0.024361, - "end_time": "2026-09-23T14:35:26.420222+00:00", + "duration": 0.00986, + "end_time": "2026-09-29T21:23:26.021078+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.395861+00:00", + "start_time": "2026-09-29T21:23:26.011218+00:00", "status": "completed" }, "tags": [] @@ -872,10 +862,10 @@ "id": "ab609e79", "metadata": { "papermill": { - "duration": 0.004993, - "end_time": "2026-09-23T14:35:26.430507+00:00", + "duration": 0.003645, + "end_time": "2026-09-29T21:23:26.028563+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.425514+00:00", + "start_time": "2026-09-29T21:23:26.024918+00:00", "status": "completed" }, "tags": [] @@ -899,16 +889,16 @@ "id": "931b5c66", "metadata": { "execution": { - "iopub.execute_input": "2026-09-23T14:35:26.442759Z", - "iopub.status.busy": "2026-09-23T14:35:26.442232Z", - "iopub.status.idle": "2026-09-23T14:35:26.452336Z", - "shell.execute_reply": "2026-09-23T14:35:26.450840Z" + "iopub.execute_input": "2026-09-29T21:23:26.037624Z", + "iopub.status.busy": "2026-09-29T21:23:26.037386Z", + "iopub.status.idle": "2026-09-29T21:23:26.043969Z", + "shell.execute_reply": "2026-09-29T21:23:26.043080Z" }, "papermill": { - "duration": 0.018418, - "end_time": "2026-09-23T14:35:26.453668+00:00", + "duration": 0.012818, + "end_time": "2026-09-29T21:23:26.045086+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.435250+00:00", + "start_time": "2026-09-29T21:23:26.032268+00:00", "status": "completed" }, "tags": [] @@ -957,10 +947,10 @@ "id": "0c4103c6", "metadata": { "papermill": { - "duration": 0.005395, - "end_time": "2026-09-23T14:35:26.465209+00:00", + "duration": 0.004208, + "end_time": "2026-09-29T21:23:26.053287+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.459814+00:00", + "start_time": "2026-09-29T21:23:26.049079+00:00", "status": "completed" }, "tags": [] @@ -980,10 +970,10 @@ "id": "cell-68fc25a0", "metadata": { "papermill": { - "duration": 0.005343, - "end_time": "2026-09-23T14:35:26.475579+00:00", + "duration": 0.003793, + "end_time": "2026-09-29T21:23:26.060884+00:00", "exception": false, - "start_time": "2026-09-23T14:35:26.470236+00:00", + "start_time": "2026-09-29T21:23:26.057091+00:00", "status": "completed" }, "tags": [] @@ -1035,14 +1025,14 @@ }, "papermill": { "default_parameters": {}, - "duration": 29.062079, - "end_time": "2026-09-23T14:35:27.493220+00:00", + "duration": 23.610878, + "end_time": "2026-09-29T21:23:26.963950+00:00", "environment_variables": {}, "exception": null, - "input_path": "MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb", - "output_path": "MyIA.AI.Notebooks/ML/DataScienceWithAgents/Track1-LangChain/Day3-Data-Agents/Labs/Lab7-Data-Analysis-Agent/Lab7-Data-Analysis-Agent.ipynb", + "input_path": "Lab7-Data-Analysis-Agent.ipynb", + "output_path": "Lab7-Data-Analysis-Agent.ipynb", "parameters": {}, - "start_time": "2026-09-23T14:34:58.431141+00:00", + "start_time": "2026-09-29T21:23:03.353072+00:00", "version": "2.7.0" } },