{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Résultats du DNB session 2017 à Mayotte" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017 = pd.read_csv(\"./resltat_dnb_2017.csv\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CollègeVillePrésents\n", "au DNBTaux de réussiteTaux de mentions
0SADASada22981.66 %49.78 %
1KANI-KELIKani keli15885.44 %48.10 %
2BANDRELEBandrele17678.41 %47.73 %
3PASSAMAINTYMamoudzou34487.21 %47.67 %
4KAWENI 1Mamoudzou33386.79 %47.15 %
5KAWENI 2Mamoudzou27387.91 %45.79 %
6TSIMKOURAChirongui30384.82 %44.55 %
7ZENA M'DEREPamandzi34873.28 %43.68 %
8MTSAMBOROMtsamboro20375.37 %42.86 %
9NELSON MANDELAMamoudzou39880.15 %41.71 %
10BOUENI M TITIDzaoudzi35279.26 %41.19 %
11ALI HALIDIChiconi34880.46 %40.23 %
12TSINGONITsingoni27576.36 %40.00 %
13KOUNGOUKoungou40082.00 %38.75 %
14M'GOMBANIMamoudzou38573.77 %37.40 %
15DZOUMOGNEBandraboua24478.28 %36.89 %
16M'TSANGAMOUJIM tsangamouji26479.17 %35.23 %
17ZAKIA MADIDembeni40677.09 %34.98 %
\n", "
" ], "text/plain": [ " Collège Ville Présents\\nau DNB Taux de réussite \\\n", "0 SADA Sada 229 81.66 % \n", "1 KANI-KELI Kani keli 158 85.44 % \n", "2 BANDRELE Bandrele 176 78.41 % \n", "3 PASSAMAINTY Mamoudzou 344 87.21 % \n", "4 KAWENI 1 Mamoudzou 333 86.79 % \n", "5 KAWENI 2 Mamoudzou 273 87.91 % \n", "6 TSIMKOURA Chirongui 303 84.82 % \n", "7 ZENA M'DERE Pamandzi 348 73.28 % \n", "8 MTSAMBORO Mtsamboro 203 75.37 % \n", "9 NELSON MANDELA Mamoudzou 398 80.15 % \n", "10 BOUENI M TITI Dzaoudzi 352 79.26 % \n", "11 ALI HALIDI Chiconi 348 80.46 % \n", "12 TSINGONI Tsingoni 275 76.36 % \n", "13 KOUNGOU Koungou 400 82.00 % \n", "14 M'GOMBANI Mamoudzou 385 73.77 % \n", "15 DZOUMOGNE Bandraboua 244 78.28 % \n", "16 M'TSANGAMOUJI M tsangamouji 264 79.17 % \n", "17 ZAKIA MADI Dembeni 406 77.09 % \n", "\n", " Taux de mentions \n", "0 49.78 % \n", "1 48.10 % \n", "2 47.73 % \n", "3 47.67 % \n", "4 47.15 % \n", "5 45.79 % \n", "6 44.55 % \n", "7 43.68 % \n", "8 42.86 % \n", "9 41.71 % \n", "10 41.19 % \n", "11 40.23 % \n", "12 40.00 % \n", "13 38.75 % \n", "14 37.40 % \n", "15 36.89 % \n", "16 35.23 % \n", "17 34.98 % " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def p2f(x):\n", " return float(x.strip('%'))/100" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017 = dnb2017.assign(\n", " tx_mention = dnb2017['Taux de mentions'].apply(p2f),\n", " tx_admis = dnb2017['Taux de réussite'].apply(p2f),\n", ")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017 = dnb2017.assign(\n", " nbr_admis = (dnb2017[\"Présents\\nau DNB\"] * dnb2017[\"tx_admis\"]).astype(int),\n", " nbr_mentions = (dnb2017[\"Présents\\nau DNB\"] * dnb2017[\"tx_mention\"]).astype(int),\n", ")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017 = dnb2017.assign(\n", " nbr_sans_mentions = dnb2017['nbr_admis'] - dnb2017['nbr_mentions']\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017 = dnb2017.assign(\n", " tx_non_admis = 1 - dnb2017[\"tx_admis\"],\n", " tx_sans_mention = dnb2017['tx_admis'] - dnb2017['tx_mention']\n", ")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CollègeVillePrésents\n", "au DNBTaux de réussiteTaux de mentionstx_admistx_mentionnbr_admisnbr_mentionsnbr_sans_mentionstx_non_admistx_sans_mention
0SADASada22981.66 %49.78 %0.81660.4978187113740.18340.3188
1KANI-KELIKani keli15885.44 %48.10 %0.85440.481013475590.14560.3734
2BANDRELEBandrele17678.41 %47.73 %0.78410.477313884540.21590.3068
3PASSAMAINTYMamoudzou34487.21 %47.67 %0.87210.47673001631370.12790.3954
4KAWENI 1Mamoudzou33386.79 %47.15 %0.86790.47152891571320.13210.3964
5KAWENI 2Mamoudzou27387.91 %45.79 %0.87910.45792391251140.12090.4212
6TSIMKOURAChirongui30384.82 %44.55 %0.84820.44552571341230.15180.4027
7ZENA M'DEREPamandzi34873.28 %43.68 %0.73280.43682551521030.26720.2960
8MTSAMBOROMtsamboro20375.37 %42.86 %0.75370.428615387660.24630.3251
9NELSON MANDELAMamoudzou39880.15 %41.71 %0.80150.41713181661520.19850.3844
10BOUENI M TITIDzaoudzi35279.26 %41.19 %0.79260.41192781441340.20740.3807
11ALI HALIDIChiconi34880.46 %40.23 %0.80460.40232801401400.19540.4023
12TSINGONITsingoni27576.36 %40.00 %0.76360.4000209110990.23640.3636
13KOUNGOUKoungou40082.00 %38.75 %0.82000.38753281551730.18000.4325
14M'GOMBANIMamoudzou38573.77 %37.40 %0.73770.37402841431410.26230.3637
15DZOUMOGNEBandraboua24478.28 %36.89 %0.78280.3689191901010.21720.4139
16M'TSANGAMOUJIM tsangamouji26479.17 %35.23 %0.79170.3523209931160.20830.4394
17ZAKIA MADIDembeni40677.09 %34.98 %0.77090.34983121421700.22910.4211
\n", "
" ], "text/plain": [ " Collège Ville Présents\\nau DNB Taux de réussite \\\n", "0 SADA Sada 229 81.66 % \n", "1 KANI-KELI Kani keli 158 85.44 % \n", "2 BANDRELE Bandrele 176 78.41 % \n", "3 PASSAMAINTY Mamoudzou 344 87.21 % \n", "4 KAWENI 1 Mamoudzou 333 86.79 % \n", "5 KAWENI 2 Mamoudzou 273 87.91 % \n", "6 TSIMKOURA Chirongui 303 84.82 % \n", "7 ZENA M'DERE Pamandzi 348 73.28 % \n", "8 MTSAMBORO Mtsamboro 203 75.37 % \n", "9 NELSON MANDELA Mamoudzou 398 80.15 % \n", "10 BOUENI M TITI Dzaoudzi 352 79.26 % \n", "11 ALI HALIDI Chiconi 348 80.46 % \n", "12 TSINGONI Tsingoni 275 76.36 % \n", "13 KOUNGOU Koungou 400 82.00 % \n", "14 M'GOMBANI Mamoudzou 385 73.77 % \n", "15 DZOUMOGNE Bandraboua 244 78.28 % \n", "16 M'TSANGAMOUJI M tsangamouji 264 79.17 % \n", "17 ZAKIA MADI Dembeni 406 77.09 % \n", "\n", " Taux de mentions tx_admis tx_mention nbr_admis nbr_mentions \\\n", "0 49.78 % 0.8166 0.4978 187 113 \n", "1 48.10 % 0.8544 0.4810 134 75 \n", "2 47.73 % 0.7841 0.4773 138 84 \n", "3 47.67 % 0.8721 0.4767 300 163 \n", "4 47.15 % 0.8679 0.4715 289 157 \n", "5 45.79 % 0.8791 0.4579 239 125 \n", "6 44.55 % 0.8482 0.4455 257 134 \n", "7 43.68 % 0.7328 0.4368 255 152 \n", "8 42.86 % 0.7537 0.4286 153 87 \n", "9 41.71 % 0.8015 0.4171 318 166 \n", "10 41.19 % 0.7926 0.4119 278 144 \n", "11 40.23 % 0.8046 0.4023 280 140 \n", "12 40.00 % 0.7636 0.4000 209 110 \n", "13 38.75 % 0.8200 0.3875 328 155 \n", "14 37.40 % 0.7377 0.3740 284 143 \n", "15 36.89 % 0.7828 0.3689 191 90 \n", "16 35.23 % 0.7917 0.3523 209 93 \n", "17 34.98 % 0.7709 0.3498 312 142 \n", "\n", " nbr_sans_mentions tx_non_admis tx_sans_mention \n", "0 74 0.1834 0.3188 \n", "1 59 0.1456 0.3734 \n", "2 54 0.2159 0.3068 \n", "3 137 0.1279 0.3954 \n", "4 132 0.1321 0.3964 \n", "5 114 0.1209 0.4212 \n", "6 123 0.1518 0.4027 \n", "7 103 0.2672 0.2960 \n", "8 66 0.2463 0.3251 \n", "9 152 0.1985 0.3844 \n", "10 134 0.2074 0.3807 \n", "11 140 0.1954 0.4023 \n", "12 99 0.2364 0.3636 \n", "13 173 0.1800 0.4325 \n", "14 141 0.2623 0.3637 \n", "15 101 0.2172 0.4139 \n", "16 116 0.2083 0.4394 \n", "17 170 0.2291 0.4211 " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['Collège', 'Ville', 'Présents\\nau DNB', 'Taux de réussite',\n", " 'Taux de mentions', 'tx_admis', 'tx_mention', 'nbr_admis',\n", " 'nbr_mentions', 'nbr_sans_mentions', 'tx_non_admis', 'tx_sans_mention'],\n", " dtype='object')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017.columns" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": true, "scrolled": true }, "outputs": [], "source": [ "dnb2017_ville = dnb2017.groupby('Ville')['Présents\\nau DNB', 'nbr_admis', 'nbr_mentions', 'nbr_sans_mentions'].sum()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017_ville = dnb2017_ville.assign(\n", " nbr_non_admis = dnb2017_ville['Présents\\nau DNB'] - dnb2017_ville['nbr_admis']\n", ")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017_ville = dnb2017_ville.assign(\n", " tx_non_admis = dnb2017_ville['nbr_non_admis'] / dnb2017_ville['Présents\\nau DNB'] * 100,\n", " tx_sans_mention = dnb2017_ville['nbr_sans_mentions'] / dnb2017_ville['Présents\\nau DNB'] * 100,\n", " tx_avec_mention = dnb2017_ville['nbr_mentions'] / dnb2017_ville['Présents\\nau DNB'] * 100,\n", " )" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [], "source": [ "dnb2017_ville = dnb2017_ville.reset_index()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
VillePrésents\n", "au DNBnbr_admisnbr_mentionsnbr_sans_mentionsnbr_non_admistx_avec_mentiontx_non_admistx_sans_mention
0Bandraboua244191901015336.88524621.72131141.393443
1Bandrele17613884543847.72727321.59090930.681818
2Chiconi3482801401406840.22988519.54023040.229885
3Chirongui3032571341234644.22442215.18151840.594059
4Dembeni4063121421709434.97536923.15270941.871921
5Dzaoudzi3522781441347440.90909121.02272738.068182
6Kani keli15813475592447.46835415.18987337.341772
7Koungou4003281551737238.75000018.00000043.250000
8M tsangamouji264209931165535.22727320.83333343.939394
9Mamoudzou1733143075467630343.50836717.48413239.007501
10Mtsamboro20315387665042.85714324.63054232.512315
11Pamandzi3482551521039343.67816126.72413829.597701
12Sada229187113744249.34497818.34061132.314410
13Tsingoni275209110996640.00000024.00000036.000000
\n", "
" ], "text/plain": [ " Ville Présents\\nau DNB nbr_admis nbr_mentions \\\n", "0 Bandraboua 244 191 90 \n", "1 Bandrele 176 138 84 \n", "2 Chiconi 348 280 140 \n", "3 Chirongui 303 257 134 \n", "4 Dembeni 406 312 142 \n", "5 Dzaoudzi 352 278 144 \n", "6 Kani keli 158 134 75 \n", "7 Koungou 400 328 155 \n", "8 M tsangamouji 264 209 93 \n", "9 Mamoudzou 1733 1430 754 \n", "10 Mtsamboro 203 153 87 \n", "11 Pamandzi 348 255 152 \n", "12 Sada 229 187 113 \n", "13 Tsingoni 275 209 110 \n", "\n", " nbr_sans_mentions nbr_non_admis tx_avec_mention tx_non_admis \\\n", "0 101 53 36.885246 21.721311 \n", "1 54 38 47.727273 21.590909 \n", "2 140 68 40.229885 19.540230 \n", "3 123 46 44.224422 15.181518 \n", "4 170 94 34.975369 23.152709 \n", "5 134 74 40.909091 21.022727 \n", "6 59 24 47.468354 15.189873 \n", "7 173 72 38.750000 18.000000 \n", "8 116 55 35.227273 20.833333 \n", "9 676 303 43.508367 17.484132 \n", "10 66 50 42.857143 24.630542 \n", "11 103 93 43.678161 26.724138 \n", "12 74 42 49.344978 18.340611 \n", "13 99 66 40.000000 24.000000 \n", "\n", " tx_sans_mention \n", "0 41.393443 \n", "1 30.681818 \n", "2 40.229885 \n", "3 40.594059 \n", "4 41.871921 \n", "5 38.068182 \n", "6 37.341772 \n", "7 43.250000 \n", "8 43.939394 \n", "9 39.007501 \n", "10 32.512315 \n", "11 29.597701 \n", "12 32.314410 \n", "13 36.000000 " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017_ville" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pygal\n", "from pygal.style import Style\n", "custom_style = Style(\n", " font_family = \"Ubuntu Mono derivative Powerline\",\n", " value_font_size = 12,\n", " legend_font_size = 12,\n", " title_font_size = 14,\n", " background='transparent',\n", " plot_background='transparent',\n", " #background = \"ffffff00\",\n", " #plot_background = \"ffffff00\",\n", " \n", ")\n", "from IPython.display import HTML\n", "from pygal.style import RedBlueStyle" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Camenberts pour chaque ville" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['Ville', 'Présents\\nau DNB', 'nbr_admis', 'nbr_mentions',\n", " 'nbr_sans_mentions', 'nbr_non_admis', 'tx_avec_mention', 'tx_non_admis',\n", " 'tx_sans_mention'],\n", " dtype='object')" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017_ville.columns" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "collapsed": true }, "outputs": [], "source": [ "for ix, clg in dnb2017.iterrows():\n", " pie_chart = pygal.Pie(width=200, height=200,\n", " print_values=True, show_legend=False,\n", " #legend_at_bottom=True, legend_at_bottom_columns=3, truncate_legend=20,\n", " inner_radius=.5, formatter=lambda x:f\"{int(round(x*100,0))} %\",\\\n", " style=RedBlueStyle)\n", " #style=custom_style)\n", " pie_chart.title = f\"{clg['Ville']}\"\n", " pie_chart.add('Non admis', [{'value': clg['tx_non_admis'], 'label': \"plop\"}])\n", " pie_chart.add('Admis sans mention', clg['tx_sans_mention'])\n", " pie_chart.add('Admis avec mention', clg['tx_mention'])\n", " pie_chart.render_to_file(f\"./fig/pie_{clg['Ville']}.svg\")\n", " #pie_chart.render_to_png(f\"./fig/pie_{clg['Collège']}.png\")\n", " #display({'image/svg+xml': pie_chart.render()}, raw=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Diagramme du nombre d'admis en fonction du collège" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": true }, "outputs": [], "source": [ "values = dnb2017['nbr_admis']\n", "labels = dnb2017['Collège']" ] }, { "cell_type": "code", "execution_count": 73, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "PygalSADA0.02777777778KANI-KELI0.08333333333BANDRELE0.1388888889PASSAMAINTY0.1944444444KAWENI 10.25KAWENI 20.3055555556TSIMKOURA0.3611111111ZENA M'DERE0.4166666667MTSAMBORO0.4722222222NELSON MANDELA0.5277777778BOUENI M TITI0.5833333333ALI HALIDI0.6388888889TSINGONI0.6944444444KOUNGOU0.75M'GOMBANI0.8055555556DZOUMOGNE0.8611111111M'TSANGAMOUJI0.9166666667ZAKIA MADI0.972222222204080120160200240280320187154.407786116515.1923076923076SADA134113.514258912486.34615384615387KANI-KELI138116.600562852457.5BANDRELE300241.59587242428.6538461538462PASSAMAINTY289233.108536585399.8076923076924KAWENI 1239194.529737336370.96153846153845KAWENI 2257208.418105066342.11538461538464TSIMKOURA255206.874953096313.2692307692308ZENA M'DERE153128.174202627284.42307692307696MTSAMBORO318255.48424015255.57692307692307NELSON MANDELA278224.62120075226.7307692307692BOUENI M TITI280226.16435272197.8846153846154ALI HALIDI209171.382457786169.03846153846152TSINGONI328263.2140.1923076923077KOUNGOU284229.25065666111.34615384615385M'GOMBANI191157.49409005682.49999999999999DZOUMOGNE209171.38245778653.65384615384623M'TSANGAMOUJI312250.8547842424.80769230769236ZAKIA MADINombre d'admis" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "bar_chart = pygal.HorizontalBar(style=RedBlueStyle)\n", "#bar_chart = pygal.Bar(x_label_rotation=90, style=custom_style)\n", "bar_chart.add(\"Nombre d'admis\", values)\n", "bar_chart.x_labels = labels\n", "display({'image/svg+xml': bar_chart.render()}, raw=True)\n", "#bar_chart.render_to_file(f\"./fig/bar_admis_clg.svg\")" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Tableau des colleges avec le plus de mentions" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "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", " \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", " \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", "
CollègeVillePrésents\n", "au DNBTaux de réussiteTaux de mentionstx_admistx_mentionnbr_admisnbr_mentionsnbr_sans_mentionstx_non_admistx_sans_mention
0SADASada22981.66 %49.78 %0.81660.4978187113740.18340.3188
1KANI-KELIKani keli15885.44 %48.10 %0.85440.481013475590.14560.3734
2BANDRELEBandrele17678.41 %47.73 %0.78410.477313884540.21590.3068
3PASSAMAINTYMamoudzou34487.21 %47.67 %0.87210.47673001631370.12790.3954
4KAWENI 1Mamoudzou33386.79 %47.15 %0.86790.47152891571320.13210.3964
\n", "
" ], "text/plain": [ " Collège Ville Présents\\nau DNB Taux de réussite Taux de mentions \\\n", "0 SADA Sada 229 81.66 % 49.78 % \n", "1 KANI-KELI Kani keli 158 85.44 % 48.10 % \n", "2 BANDRELE Bandrele 176 78.41 % 47.73 % \n", "3 PASSAMAINTY Mamoudzou 344 87.21 % 47.67 % \n", "4 KAWENI 1 Mamoudzou 333 86.79 % 47.15 % \n", "\n", " tx_admis tx_mention nbr_admis nbr_mentions nbr_sans_mentions \\\n", "0 0.8166 0.4978 187 113 74 \n", "1 0.8544 0.4810 134 75 59 \n", "2 0.7841 0.4773 138 84 54 \n", "3 0.8721 0.4767 300 163 137 \n", "4 0.8679 0.4715 289 157 132 \n", "\n", " tx_non_admis tx_sans_mention \n", "0 0.1834 0.3188 \n", "1 0.1456 0.3734 \n", "2 0.2159 0.3068 \n", "3 0.1279 0.3954 \n", "4 0.1321 0.3964 " ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dnb2017.head()" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "top_mentions = dnb2017[['Collège', 'nbr_mentions']].sort_values('nbr_mentions',ascending=False).head(3)" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "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", "
Collègenbr_mentions
9NELSON MANDELA166
3PASSAMAINTY163
4KAWENI 1157
\n", "
" ], "text/plain": [ " Collège nbr_mentions\n", "9 NELSON MANDELA 166\n", "3 PASSAMAINTY 163\n", "4 KAWENI 1 157" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "top_mentions" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [], "source": [ "line_chart = pygal.Bar()\n", "line_chart.title = 'Top 3 du nombre de mentions'\n", "line_chart.x_labels = top_mentions['Collège']\n", "line_chart.add('Nombre de mentions', top_mentions['nbr_mentions'])\n", "with open(\"./fig/top3mentions.svg\", \"w\") as f:\n", " f.write(line_chart.render_table(style=True))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.2" } }, "nbformat": 4, "nbformat_minor": 2 }