From 6738419f7c1b49bcdd09a2ffe2ab1438b6751778 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Mon, 15 Sep 2025 20:02:19 +0200 Subject: [PATCH] Add new plot --- .../TP_1/2025_TP_1_M2_ISF.ipynb | 1177 ++++++++++++++--- 1 file changed, 1029 insertions(+), 148 deletions(-) diff --git a/M2/Machine Learning/TP_1/2025_TP_1_M2_ISF.ipynb b/M2/Machine Learning/TP_1/2025_TP_1_M2_ISF.ipynb index 0f4c486..94de13d 100644 --- a/M2/Machine Learning/TP_1/2025_TP_1_M2_ISF.ipynb +++ b/M2/Machine Learning/TP_1/2025_TP_1_M2_ISF.ipynb @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 64, "id": "e5631491", "metadata": {}, "outputs": [ @@ -71,7 +71,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 65, "id": "b8acd836", "metadata": {}, "outputs": [ @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 66, "id": "acc09d5e", "metadata": {}, "outputs": [ @@ -130,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 67, "id": "8590bf3a", "metadata": {}, "outputs": [ @@ -149,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 68, "id": "20165055", "metadata": {}, "outputs": [ @@ -159,7 +159,7 @@ "4" ] }, - "execution_count": 6, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } @@ -178,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 69, "id": "4028380e", "metadata": {}, "outputs": [ @@ -205,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 70, "id": "f2ab3b16", "metadata": {}, "outputs": [ @@ -237,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 71, "id": "817fddfd", "metadata": {}, "outputs": [ @@ -292,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 72, "id": "98874653", "metadata": {}, "outputs": [ @@ -301,10 +301,10 @@ "output_type": "stream", "text": [ "[6, 7, 8]\n", - "132 ns ± 1.59 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)\n", + "159 ns ± 37 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)\n", "[24333339, 24333340, 24333341]\n", "[6, 7, 8]\n", - "84.1 ns ± 2.37 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)\n", + "81.5 ns ± 2.51 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)\n", "[3, 4, 5]\n", "0 3\n", "1 4\n", @@ -332,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 73, "id": "fd4a92a4", "metadata": {}, "outputs": [ @@ -394,7 +394,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 74, "id": "02221362", "metadata": {}, "outputs": [ @@ -464,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 75, "id": "dc035fc6", "metadata": {}, "outputs": [ @@ -536,7 +536,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 76, "id": "fb8a02fc", "metadata": {}, "outputs": [ @@ -544,14 +544,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "1 0.053135\n", - "2 0.538664\n", - "3 0.576006\n", - "5 -0.694670\n", - "dtype: float64 1 1.683220\n", - "2 0.271148\n", - "3 1.446795\n", - "4 -0.840798\n", + "1 0.243129\n", + "2 0.120497\n", + "3 0.661678\n", + "5 0.431023\n", + "dtype: float64 1 -1.877149\n", + "2 1.084410\n", + "3 -1.401333\n", + "4 2.323768\n", "dtype: float64\n" ] } @@ -576,7 +576,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 77, "id": "c414f7ab", "metadata": {}, "outputs": [ @@ -585,11 +585,11 @@ "output_type": "stream", "text": [ " s t\n", - "1 0.053135 1.683220\n", - "2 0.538664 0.271148\n", - "3 0.576006 1.446795\n", - "4 NaN -0.840798\n", - "5 -0.694670 NaN\n" + "1 0.243129 -1.877149\n", + "2 0.120497 1.084410\n", + "3 0.661678 -1.401333\n", + "4 NaN 2.323768\n", + "5 0.431023 NaN\n" ] } ], @@ -615,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 78, "id": "d385358c", "metadata": {}, "outputs": [ @@ -624,11 +624,11 @@ "output_type": "stream", "text": [ " s t SUM\n", - "1 0.053135 1.683220 1.736354\n", - "2 0.538664 0.271148 0.809813\n", - "3 0.576006 1.446795 2.022801\n", - "4 NaN -0.840798 NaN\n", - "5 -0.694670 NaN NaN\n" + "1 0.243129 -1.877149 -1.634020\n", + "2 0.120497 1.084410 1.204908\n", + "3 0.661678 -1.401333 -0.739655\n", + "4 NaN 2.323768 NaN\n", + "5 0.431023 NaN NaN\n" ] } ], @@ -649,7 +649,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 79, "id": "004ea932", "metadata": {}, "outputs": [ @@ -657,7 +657,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1.5229892450910516\n" + "-0.389589093728373\n" ] } ], @@ -698,7 +698,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 80, "id": "90c3ce0c", "metadata": {}, "outputs": [ @@ -706,48 +706,69 @@ "name": "stdout", "output_type": "stream", "text": [ - "[ 1.26850579 -0.53602014 1.18237229 0.88645126 -0.03397872 -2.45881857\n", - " 1.76550925 0.97842704 -1.23803463 -1.17616532 -1.07298085 0.28692028\n", - " -1.25844656 -0.27629662 0.16911664 1.68324856 -0.45549311 0.92244219\n", - " 0.50774379 -0.26813407 0.7254944 -0.27876468 1.2876827 0.0724938\n", - " 0.6602081 -0.5579877 1.32527871 2.00923662 0.25209214 0.9672155\n", - " 1.0227091 -1.10271854 0.29061504 -0.43933754 1.30977419 0.43179925\n", - " 0.32568659 0.55678212 0.23101913 -1.89053731 -0.82680632 1.84303816\n", - " -1.15812936 -0.18703471 -0.7412374 1.30641493 2.35216301 1.68099702\n", - " 0.71063655 -0.69318686 0.60396736 -0.99943433 0.71180149 -0.49391377\n", - " -1.40910774 -0.74416175 -0.06017552 1.3752385 -0.14577478 -1.11804075\n", - " -1.88309881 1.29822396 -0.3779163 -0.89369925 -0.62121111 0.04494389\n", - " 0.57479296 -0.87714059 -0.92562419 -1.11479699 0.54884285 0.57446685\n", - " -1.69931449 0.46795936 0.81885811 0.29880544 -0.52503035 0.2778053\n", - " -0.23088543 -1.38023516 0.01513619 -0.36382265 -0.0600343 -1.00592704\n", - " -0.25299926 -1.52717073 -0.88354173 -1.0897053 1.39480018 -0.97288183\n", - " 0.03065257 -0.02645009 -0.80984299 -0.75669696 -1.21306362 0.03552965\n", - " 0.93287107 -1.1959376 1.35202411 1.01674895 -0.26505176 1.53781692\n", - " -0.94548572 -0.13563897 0.3853298 -0.66242869 -0.72178182 1.64259587\n", - " -0.96306148 0.2994465 0.96098149 1.22527932 0.02126978 -0.58036244\n", - " -0.17109957 -0.48745199 0.68798863 0.4201078 -1.26565809 -0.49321905\n", - " 2.79743177 0.54532711 0.7432006 -0.41007388 -0.56240765 1.2554423\n", - " 1.82205488 -0.16935065 1.07878571 -0.14987939 -0.17810106 2.10866444\n", - " -0.146496 0.28316255 1.71000909 -0.28359816 -0.62886104 1.20614176\n", - " 1.19205422 -0.34268548 -1.30143315 0.85459154 -0.39152603 0.08762179\n", - " 0.03654686 -0.08612075 0.67277947 -1.7137491 0.08208218 1.44184664\n", - " -0.44046146 -1.33183826 0.53728612 -1.11562499 0.06376464 2.61880348\n", - " -0.93665465 0.39630573 -1.15101907 -1.64000265 0.06310666 -0.53254498\n", - " -0.6508408 -0.36955452 -1.6790859 0.11046776 -0.40907249 1.75255499\n", - " -0.17599093 0.26808477 0.22899155 1.17041568 1.1768919 -0.81582218\n", - " 0.27463614 0.16083836 -2.77111172 -0.44668008 -0.57452765 -0.36160307\n", - " -0.78039335 1.62350826 -0.50367022 -0.88046456 -0.02404358 0.1872916\n", - " 0.31717553 -0.35395365 0.6693406 -0.15927009 0.80911142 0.29309307\n", - " 1.21182873 1.53249035 -0.21427204 0.05776381 -0.7284014 -1.05463621\n", - " 1.74195223 0.35124313 1.05008367 -0.08944134 -1.91651391 -0.49130044\n", - " -0.10465923 -0.22032511 -0.83176262 -0.17541312 -0.029542 0.93834253\n", - " 1.16124126 0.75950911 -0.02166179 -0.455731 0.21971441 0.53133641\n", - " -0.22400362 -0.25990138 0.22630615 -0.96844131 -0.18722489 1.26743517\n", - " -1.41379542 1.1781159 -0.65525168 0.61893765 -1.83001684 1.14052822\n", - " 0.64814276 -0.01790324 -0.65441319 -1.7637243 0.14367763 0.93064339\n", - " 0.05925196 -2.31750065 1.36433031 -0.5410643 1.12086703 -1.30300879\n", - " 0.78158538 -0.55339593 0.26091608 0.45875776 -0.70090081 -0.47856098\n", - " 0.96256357 0.09448339 1.257779 -0.50959256]\n", + "[ 5.49723823e-01 -1.31082378e+00 -6.22760329e-01 -2.62949717e-01\n", + " 4.57882668e-01 -1.59461170e+00 1.05538811e+00 -2.47209963e-01\n", + " 7.13256480e-01 1.44496096e+00 8.23773799e-01 -3.30667927e-01\n", + " -9.56503260e-02 7.45352858e-01 -4.32283190e-01 2.31530959e-01\n", + " 6.37509236e-01 2.31185634e-01 -1.20012729e+00 -2.35712669e-02\n", + " 3.17696113e-01 -2.88214765e+00 -1.23726528e+00 -6.97195930e-01\n", + " -4.87292472e-01 -1.01214626e+00 1.61589513e+00 3.37852380e-01\n", + " -1.74946052e-01 -1.20920617e+00 9.03870311e-02 -3.07258009e-01\n", + " -3.10397749e-01 -3.32008854e-01 -1.15886038e+00 2.12804614e-01\n", + " 2.60152242e-01 -1.29252004e+00 -3.33166985e+00 -4.69845591e-01\n", + " -2.25371388e+00 1.61491101e+00 -2.75463852e-01 3.88422564e-01\n", + " -1.02801527e-01 2.08622449e+00 -6.13437096e-01 1.41284922e-01\n", + " -7.78141741e-01 7.39777873e-01 -1.64159000e+00 1.24423378e+00\n", + " 7.48597865e-01 8.74895734e-01 -1.08514842e+00 1.12577205e+00\n", + " -2.57945739e-01 -6.90450632e-01 -5.69399190e-01 -2.31033310e-01\n", + " -4.83728490e-01 -2.14742654e-01 -7.51141688e-01 7.66933693e-01\n", + " -9.57226686e-01 -4.30699928e-01 2.28666912e-01 8.61871499e-01\n", + " 1.03068499e+00 2.17921640e+00 -6.02719103e-01 1.64892582e-01\n", + " -2.22512366e-01 -1.81064011e-01 -1.91618541e+00 -1.83873109e-01\n", + " -9.29893809e-01 -9.01671426e-01 8.35696189e-01 3.14861256e-01\n", + " 2.47187503e-01 1.53374094e+00 -3.14452903e+00 -1.55291714e+00\n", + " 7.88856808e-01 -1.82891453e+00 -1.66248048e+00 3.87953404e-01\n", + " 7.34848194e-01 5.66630707e-01 -1.91984446e+00 -7.94352703e-01\n", + " -1.07785703e+00 1.20883414e+00 -4.67383798e-01 2.53383618e+00\n", + " -1.37801661e+00 -1.91719281e-01 -8.07215757e-01 6.81252472e-01\n", + " -1.00333308e+00 1.20718757e+00 -1.65435057e+00 6.08411511e-01\n", + " 1.04282471e-01 -5.66180100e-01 -1.32743256e-01 -1.31161120e+00\n", + " 9.60961716e-01 -5.93451605e-01 2.69214343e-01 4.98934405e-01\n", + " -1.66050737e-01 -8.62418377e-02 -2.59329804e+00 3.62691383e-01\n", + " 1.56065069e+00 -1.19008019e+00 -4.12291407e-01 -5.65906249e-02\n", + " 1.07063941e+00 -1.55673086e+00 5.80081641e-01 -2.98945228e-01\n", + " 6.00838705e-01 -1.09766403e+00 1.46468310e+00 4.33030265e-02\n", + " 5.37300372e-02 5.69581246e-01 -8.38004229e-01 2.17191762e+00\n", + " 2.61695242e-01 -2.26121746e-01 1.76349971e-01 -2.99109244e-01\n", + " 8.55575563e-01 1.08929611e+00 -1.75560658e+00 -4.94108477e-01\n", + " -1.20773476e+00 5.99213072e-01 -4.70264655e-01 -2.83854681e+00\n", + " -6.67533402e-01 2.68384595e-03 -2.28505336e-01 -1.66896521e-01\n", + " 3.83767940e-01 -8.18634351e-01 -1.80681435e-02 1.95678277e+00\n", + " -3.19979705e-01 1.04908399e+00 -1.79325760e-01 1.05356993e+00\n", + " 8.44210718e-01 -1.13155820e-01 7.33324161e-02 -8.77563195e-02\n", + " -5.46247848e-01 -7.01349251e-01 -4.86817183e-01 -3.80312716e-01\n", + " 1.13385935e+00 -3.29551446e-01 4.75178143e-01 -3.99293756e-01\n", + " 3.21380689e+00 7.11493474e-01 -5.57452116e-01 -1.27923709e-01\n", + " -1.18060426e-01 -2.90118101e-01 2.55462698e+00 1.82784346e+00\n", + " 2.09441740e-01 -3.11607087e-01 1.58206957e+00 -1.03920923e+00\n", + " 1.58273642e-01 -3.87976151e-01 -2.41492247e-01 6.82781712e-01\n", + " -1.39314775e-01 1.69250146e+00 4.73171075e-01 1.23777781e+00\n", + " 1.94373099e-01 -1.31467157e+00 -4.95374012e-02 -6.35543779e-01\n", + " 1.43322926e-01 7.65554576e-01 5.25991389e-01 -1.14121490e+00\n", + " -1.59325886e+00 7.12285333e-01 1.77293192e-01 -2.01506883e+00\n", + " -9.80835679e-01 4.55426418e-01 -9.56967585e-01 -8.57511153e-01\n", + " -1.06710549e+00 -5.97830609e-01 1.33747103e+00 6.28934901e-03\n", + " 1.07189752e+00 1.59283006e-01 -3.69665818e-01 3.33204138e-01\n", + " 7.62345403e-01 5.40839445e-01 -1.11377123e-01 -4.57959689e-01\n", + " 1.56912841e+00 8.70473207e-01 -3.74765710e-01 6.87430409e-01\n", + " -4.74617018e-01 -1.57582446e+00 -8.34879110e-01 3.30927984e-01\n", + " 1.20415788e+00 7.19295702e-01 5.88584618e-01 -2.22883984e-01\n", + " -3.76034448e-01 3.77574960e-02 1.67710538e+00 -2.22784347e+00\n", + " 5.13524775e-01 -2.59294898e-02 -1.05789057e+00 -5.22341043e-01\n", + " -2.02132136e+00 -7.84539236e-01 -1.37535622e+00 4.25588428e-01\n", + " 5.09526701e-01 -7.74401045e-01 9.09169480e-01 -1.01978350e+00\n", + " -1.31227734e+00 -4.82121622e-01 4.06569462e-01 2.52543371e-01\n", + " 1.32871537e+00 2.67734602e-01]\n", "250\n" ] } @@ -764,7 +785,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 81, "id": "756550e8", "metadata": {}, "outputs": [ @@ -772,17 +793,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "2012-01-01 1.268506\n", - "2012-01-02 -0.536020\n", - "2012-01-03 1.182372\n", - "2012-01-04 0.886451\n", - "2012-01-05 -0.033979\n", + "2012-01-01 0.549724\n", + "2012-01-02 -1.310824\n", + "2012-01-03 -0.622760\n", + "2012-01-04 -0.262950\n", + "2012-01-05 0.457883\n", " ... \n", - "2012-09-02 -0.478561\n", - "2012-09-03 0.962564\n", - "2012-09-04 0.094483\n", - "2012-09-05 1.257779\n", - "2012-09-06 -0.509593\n", + "2012-09-02 -0.482122\n", + "2012-09-03 0.406569\n", + "2012-09-04 0.252543\n", + "2012-09-05 1.328715\n", + "2012-09-06 0.267735\n", "Freq: D, Length: 250, dtype: float64\n" ] } @@ -796,7 +817,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 82, "id": "91f53912", "metadata": {}, "outputs": [ @@ -846,7 +867,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 83, "id": "97d58527", "metadata": {}, "outputs": [], @@ -870,7 +891,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 84, "id": "c9597b48", "metadata": {}, "outputs": [], @@ -897,7 +918,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 85, "id": "8051b5f4", "metadata": {}, "outputs": [], @@ -916,7 +937,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 86, "id": "14b2a9c7", "metadata": {}, "outputs": [ @@ -1015,7 +1036,7 @@ "type": "float" } ], - "ref": "8001c653-5ab9-4e1f-a56c-771a96ae9787", + "ref": "e6f40b4a-5d49-4980-809e-e8d5f3af0389", "rows": [ [ "0", @@ -1296,7 +1317,7 @@ "4 (66,74] [10000;15000[ 0 0.0 1.000000 " ] }, - "execution_count": 24, + "execution_count": 86, "metadata": {}, "output_type": "execute_result" } @@ -1308,7 +1329,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 87, "id": "e85ee86b", "metadata": {}, "outputs": [ @@ -1407,7 +1428,7 @@ "type": "float" } ], - "ref": "464a2410-edf8-4e9f-953b-5b162bdeba65", + "ref": "c81a4158-60cd-44bd-b3c0-efedfd7c893d", "rows": [ [ "14259", @@ -1695,7 +1716,7 @@ "14263 0.142466 " ] }, - "execution_count": 25, + "execution_count": 87, "metadata": {}, "output_type": "execute_result" } @@ -1707,7 +1728,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 88, "id": "dbdd334a", "metadata": {}, "outputs": [ @@ -1806,7 +1827,7 @@ "type": "float" } ], - "ref": "e16b694f-6c43-4eae-82a6-04aa430f14a6", + "ref": "896fad9f-a81f-4109-b48a-0e5b5d83b56a", "rows": [ [ "count", @@ -2364,7 +2385,7 @@ "max 83421.850000 1.000000 " ] }, - "execution_count": 26, + "execution_count": 88, "metadata": {}, "output_type": "execute_result" } @@ -2376,7 +2397,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 89, "id": "6a32bf11", "metadata": {}, "outputs": [ @@ -2386,7 +2407,7 @@ "(14264, 17)" ] }, - "execution_count": 27, + "execution_count": 89, "metadata": {}, "output_type": "execute_result" } @@ -2398,7 +2419,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 90, "id": "0e30e0ac", "metadata": {}, "outputs": [ @@ -2413,7 +2434,7 @@ " dtype='object')" ] }, - "execution_count": 28, + "execution_count": 90, "metadata": {}, "output_type": "execute_result" } @@ -2425,7 +2446,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 91, "id": "1ca6278f", "metadata": {}, "outputs": [ @@ -2444,7 +2465,7 @@ "type": "unknown" } ], - "ref": "79215742-e925-45f7-a8cc-eb1ce5720bfd", + "ref": "cf99f66f-5f2c-41ef-8cf4-870772e10c73", "rows": [ [ "ANNEE_CTR", @@ -2541,7 +2562,7 @@ "dtype: object" ] }, - "execution_count": 29, + "execution_count": 91, "metadata": {}, "output_type": "execute_result" } @@ -2562,7 +2583,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 92, "id": "184234b2", "metadata": {}, "outputs": [ @@ -2603,7 +2624,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 93, "id": "74e39ca9", "metadata": {}, "outputs": [ @@ -2645,7 +2666,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 94, "id": "0be945ad", "metadata": {}, "outputs": [ @@ -3507,7 +3528,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 95, "id": "762adc47", "metadata": {}, "outputs": [ @@ -18624,7 +18645,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 96, "id": "bb7eaef1", "metadata": {}, "outputs": [ @@ -33741,7 +33762,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 97, "id": "01231a32", "metadata": {}, "outputs": [ @@ -48858,7 +48879,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 98, "id": "1535eec5", "metadata": {}, "outputs": [ @@ -63975,7 +63996,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 99, "id": "71dfb629", "metadata": {}, "outputs": [ @@ -64830,7 +64851,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 100, "id": "27489ee0", "metadata": {}, "outputs": [ @@ -79955,7 +79976,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 101, "id": "e833f992", "metadata": {}, "outputs": [ @@ -79989,7 +80010,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 102, "id": "a5fd2159", "metadata": {}, "outputs": [], @@ -80004,7 +80025,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 103, "id": "7c73dd35", "metadata": {}, "outputs": [], @@ -80017,7 +80038,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 104, "id": "50b1c279", "metadata": {}, "outputs": [ @@ -80886,7 +80907,7 @@ " 'title_font_size': 14}\n", " )\n", "\n", - "fig" + "fig.show()" ] }, { @@ -80907,7 +80928,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 105, "id": "9b344a1e", "metadata": {}, "outputs": [ @@ -81863,7 +81884,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 106, "id": "efd61bfc", "metadata": {}, "outputs": [ @@ -81957,7 +81978,7 @@ "type": "float" } ], - "ref": "746c948a-7344-45a6-acc7-23ab08c48afe", + "ref": "12f908dd-992d-4aa3-a42f-2af790333222", "rows": [ [ "0", @@ -82227,7 +82248,7 @@ "4 [10000;15000[ 0 0.0 1.000000 " ] }, - "execution_count": 41, + "execution_count": 106, "metadata": {}, "output_type": "execute_result" } @@ -82242,7 +82263,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 107, "id": "312ff05c", "metadata": {}, "outputs": [], @@ -82259,7 +82280,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 108, "id": "2f542319", "metadata": {}, "outputs": [], @@ -82273,7 +82294,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 109, "id": "b81a48e0", "metadata": {}, "outputs": [ @@ -82367,7 +82388,7 @@ "type": "float" } ], - "ref": "7d27e457-453e-463f-94f3-c8bacb394546", + "ref": "5f3133fa-8ac9-4b19-8e6b-90d4c2816694", "rows": [ [ "0", @@ -82637,7 +82658,7 @@ "4 [10000;15000[ 0 0.0 1.000000 " ] }, - "execution_count": 44, + "execution_count": 109, "metadata": {}, "output_type": "execute_result" } @@ -82673,7 +82694,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 110, "id": "25fbe5cf", "metadata": {}, "outputs": [], @@ -82691,7 +82712,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 111, "id": "0b5caf1d", "metadata": {}, "outputs": [], @@ -82709,7 +82730,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 112, "id": "6a0f7afa", "metadata": {}, "outputs": [], @@ -82737,7 +82758,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 113, "id": "c0d7ebf9", "metadata": {}, "outputs": [], @@ -82774,7 +82795,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 114, "id": "d40508d7", "metadata": {}, "outputs": [ @@ -83649,7 +83670,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 115, "id": "1b7e6ff4", "metadata": {}, "outputs": [ @@ -84525,7 +84546,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 116, "id": "1ac452e1", "metadata": {}, "outputs": [ @@ -85416,10 +85437,870 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 117, "id": "2185245a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "ZONE_RISQUE=%{x}
FREQ=%{y}", + "legendgroup": "", + "line": { + "color": "#636efa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "Inconnu", + "J", + "K", + "L", + "M", + "R", + "S", + "T", + "X" + ], + "xaxis": "x", + "y": { + "bdata": "7fsfMSF1Lz/GMPhorzEqP6CNXnecTCs/9h+qj1CmMT8RH5JNZgMjP95qXI+ZnBU/rNRBzalUKD/+84zJ2d4zP04cFEbgvzI/GmcBNp9xZj+6JAR/Ew87P95+F6UZkS4/P3VB4ilHMj8RJoGVljVQPwAAAAAAAAAAAAAAAAAAAACqGA56SYc1PwAAAAAAAAAA", + "dtype": "f8" + }, + "yaxis": "y" + } + ], + "layout": { + "legend": { + "tracegroupgap": 0 + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "white", + "linecolor": "white", + "minorgridcolor": "white", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermap": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermap" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "#E5ECF6", + "showlakes": true, + "showland": true, + "subunitcolor": "white" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "#E5ECF6", + "polar": { + "angularaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "radialaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "yaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + }, + "zaxis": { + "backgroundcolor": "#E5ECF6", + "gridcolor": "white", + "gridwidth": 2, + "linecolor": "white", + "showbackground": true, + "ticks": "", + "zerolinecolor": "white" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "baxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + }, + "bgcolor": "#E5ECF6", + "caxis": { + "gridcolor": "white", + "linecolor": "white", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "white", + "linecolor": "white", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "white", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Fréquence de sinistres en fonction de la zone du risque du conducteur" + }, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Zone du risque du conducteur principal" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Fréquence" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "#Ecrivez votre code ici\n", "freq_by_age = data_retraitee.groupby('ZONE_RISQUE').agg({\n", @@ -85447,7 +86328,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 118, "id": "2e2486e5", "metadata": {}, "outputs": [], @@ -85465,7 +86346,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 119, "id": "63b97150", "metadata": {}, "outputs": [], @@ -85483,7 +86364,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 120, "id": "d1506c6c", "metadata": {}, "outputs": [], @@ -85501,7 +86382,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 121, "id": "9f19cc0d", "metadata": {}, "outputs": [],