{
"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",
" Collège | \n",
" Ville | \n",
" Présents\n",
"au DNB | \n",
" Taux de réussite | \n",
" Taux de mentions | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" SADA | \n",
" Sada | \n",
" 229 | \n",
" 81.66 % | \n",
" 49.78 % | \n",
"
\n",
" \n",
" 1 | \n",
" KANI-KELI | \n",
" Kani keli | \n",
" 158 | \n",
" 85.44 % | \n",
" 48.10 % | \n",
"
\n",
" \n",
" 2 | \n",
" BANDRELE | \n",
" Bandrele | \n",
" 176 | \n",
" 78.41 % | \n",
" 47.73 % | \n",
"
\n",
" \n",
" 3 | \n",
" PASSAMAINTY | \n",
" Mamoudzou | \n",
" 344 | \n",
" 87.21 % | \n",
" 47.67 % | \n",
"
\n",
" \n",
" 4 | \n",
" KAWENI 1 | \n",
" Mamoudzou | \n",
" 333 | \n",
" 86.79 % | \n",
" 47.15 % | \n",
"
\n",
" \n",
" 5 | \n",
" KAWENI 2 | \n",
" Mamoudzou | \n",
" 273 | \n",
" 87.91 % | \n",
" 45.79 % | \n",
"
\n",
" \n",
" 6 | \n",
" TSIMKOURA | \n",
" Chirongui | \n",
" 303 | \n",
" 84.82 % | \n",
" 44.55 % | \n",
"
\n",
" \n",
" 7 | \n",
" ZENA M'DERE | \n",
" Pamandzi | \n",
" 348 | \n",
" 73.28 % | \n",
" 43.68 % | \n",
"
\n",
" \n",
" 8 | \n",
" MTSAMBORO | \n",
" Mtsamboro | \n",
" 203 | \n",
" 75.37 % | \n",
" 42.86 % | \n",
"
\n",
" \n",
" 9 | \n",
" NELSON MANDELA | \n",
" Mamoudzou | \n",
" 398 | \n",
" 80.15 % | \n",
" 41.71 % | \n",
"
\n",
" \n",
" 10 | \n",
" BOUENI M TITI | \n",
" Dzaoudzi | \n",
" 352 | \n",
" 79.26 % | \n",
" 41.19 % | \n",
"
\n",
" \n",
" 11 | \n",
" ALI HALIDI | \n",
" Chiconi | \n",
" 348 | \n",
" 80.46 % | \n",
" 40.23 % | \n",
"
\n",
" \n",
" 12 | \n",
" TSINGONI | \n",
" Tsingoni | \n",
" 275 | \n",
" 76.36 % | \n",
" 40.00 % | \n",
"
\n",
" \n",
" 13 | \n",
" KOUNGOU | \n",
" Koungou | \n",
" 400 | \n",
" 82.00 % | \n",
" 38.75 % | \n",
"
\n",
" \n",
" 14 | \n",
" M'GOMBANI | \n",
" Mamoudzou | \n",
" 385 | \n",
" 73.77 % | \n",
" 37.40 % | \n",
"
\n",
" \n",
" 15 | \n",
" DZOUMOGNE | \n",
" Bandraboua | \n",
" 244 | \n",
" 78.28 % | \n",
" 36.89 % | \n",
"
\n",
" \n",
" 16 | \n",
" M'TSANGAMOUJI | \n",
" M tsangamouji | \n",
" 264 | \n",
" 79.17 % | \n",
" 35.23 % | \n",
"
\n",
" \n",
" 17 | \n",
" ZAKIA MADI | \n",
" Dembeni | \n",
" 406 | \n",
" 77.09 % | \n",
" 34.98 % | \n",
"
\n",
" \n",
"
\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",
" Collège | \n",
" Ville | \n",
" Présents\n",
"au DNB | \n",
" Taux de réussite | \n",
" Taux de mentions | \n",
" tx_admis | \n",
" tx_mention | \n",
" nbr_admis | \n",
" nbr_mentions | \n",
" nbr_sans_mentions | \n",
" tx_non_admis | \n",
" tx_sans_mention | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" SADA | \n",
" Sada | \n",
" 229 | \n",
" 81.66 % | \n",
" 49.78 % | \n",
" 0.8166 | \n",
" 0.4978 | \n",
" 187 | \n",
" 113 | \n",
" 74 | \n",
" 0.1834 | \n",
" 0.3188 | \n",
"
\n",
" \n",
" 1 | \n",
" KANI-KELI | \n",
" Kani keli | \n",
" 158 | \n",
" 85.44 % | \n",
" 48.10 % | \n",
" 0.8544 | \n",
" 0.4810 | \n",
" 134 | \n",
" 75 | \n",
" 59 | \n",
" 0.1456 | \n",
" 0.3734 | \n",
"
\n",
" \n",
" 2 | \n",
" BANDRELE | \n",
" Bandrele | \n",
" 176 | \n",
" 78.41 % | \n",
" 47.73 % | \n",
" 0.7841 | \n",
" 0.4773 | \n",
" 138 | \n",
" 84 | \n",
" 54 | \n",
" 0.2159 | \n",
" 0.3068 | \n",
"
\n",
" \n",
" 3 | \n",
" PASSAMAINTY | \n",
" Mamoudzou | \n",
" 344 | \n",
" 87.21 % | \n",
" 47.67 % | \n",
" 0.8721 | \n",
" 0.4767 | \n",
" 300 | \n",
" 163 | \n",
" 137 | \n",
" 0.1279 | \n",
" 0.3954 | \n",
"
\n",
" \n",
" 4 | \n",
" KAWENI 1 | \n",
" Mamoudzou | \n",
" 333 | \n",
" 86.79 % | \n",
" 47.15 % | \n",
" 0.8679 | \n",
" 0.4715 | \n",
" 289 | \n",
" 157 | \n",
" 132 | \n",
" 0.1321 | \n",
" 0.3964 | \n",
"
\n",
" \n",
" 5 | \n",
" KAWENI 2 | \n",
" Mamoudzou | \n",
" 273 | \n",
" 87.91 % | \n",
" 45.79 % | \n",
" 0.8791 | \n",
" 0.4579 | \n",
" 239 | \n",
" 125 | \n",
" 114 | \n",
" 0.1209 | \n",
" 0.4212 | \n",
"
\n",
" \n",
" 6 | \n",
" TSIMKOURA | \n",
" Chirongui | \n",
" 303 | \n",
" 84.82 % | \n",
" 44.55 % | \n",
" 0.8482 | \n",
" 0.4455 | \n",
" 257 | \n",
" 134 | \n",
" 123 | \n",
" 0.1518 | \n",
" 0.4027 | \n",
"
\n",
" \n",
" 7 | \n",
" ZENA M'DERE | \n",
" Pamandzi | \n",
" 348 | \n",
" 73.28 % | \n",
" 43.68 % | \n",
" 0.7328 | \n",
" 0.4368 | \n",
" 255 | \n",
" 152 | \n",
" 103 | \n",
" 0.2672 | \n",
" 0.2960 | \n",
"
\n",
" \n",
" 8 | \n",
" MTSAMBORO | \n",
" Mtsamboro | \n",
" 203 | \n",
" 75.37 % | \n",
" 42.86 % | \n",
" 0.7537 | \n",
" 0.4286 | \n",
" 153 | \n",
" 87 | \n",
" 66 | \n",
" 0.2463 | \n",
" 0.3251 | \n",
"
\n",
" \n",
" 9 | \n",
" NELSON MANDELA | \n",
" Mamoudzou | \n",
" 398 | \n",
" 80.15 % | \n",
" 41.71 % | \n",
" 0.8015 | \n",
" 0.4171 | \n",
" 318 | \n",
" 166 | \n",
" 152 | \n",
" 0.1985 | \n",
" 0.3844 | \n",
"
\n",
" \n",
" 10 | \n",
" BOUENI M TITI | \n",
" Dzaoudzi | \n",
" 352 | \n",
" 79.26 % | \n",
" 41.19 % | \n",
" 0.7926 | \n",
" 0.4119 | \n",
" 278 | \n",
" 144 | \n",
" 134 | \n",
" 0.2074 | \n",
" 0.3807 | \n",
"
\n",
" \n",
" 11 | \n",
" ALI HALIDI | \n",
" Chiconi | \n",
" 348 | \n",
" 80.46 % | \n",
" 40.23 % | \n",
" 0.8046 | \n",
" 0.4023 | \n",
" 280 | \n",
" 140 | \n",
" 140 | \n",
" 0.1954 | \n",
" 0.4023 | \n",
"
\n",
" \n",
" 12 | \n",
" TSINGONI | \n",
" Tsingoni | \n",
" 275 | \n",
" 76.36 % | \n",
" 40.00 % | \n",
" 0.7636 | \n",
" 0.4000 | \n",
" 209 | \n",
" 110 | \n",
" 99 | \n",
" 0.2364 | \n",
" 0.3636 | \n",
"
\n",
" \n",
" 13 | \n",
" KOUNGOU | \n",
" Koungou | \n",
" 400 | \n",
" 82.00 % | \n",
" 38.75 % | \n",
" 0.8200 | \n",
" 0.3875 | \n",
" 328 | \n",
" 155 | \n",
" 173 | \n",
" 0.1800 | \n",
" 0.4325 | \n",
"
\n",
" \n",
" 14 | \n",
" M'GOMBANI | \n",
" Mamoudzou | \n",
" 385 | \n",
" 73.77 % | \n",
" 37.40 % | \n",
" 0.7377 | \n",
" 0.3740 | \n",
" 284 | \n",
" 143 | \n",
" 141 | \n",
" 0.2623 | \n",
" 0.3637 | \n",
"
\n",
" \n",
" 15 | \n",
" DZOUMOGNE | \n",
" Bandraboua | \n",
" 244 | \n",
" 78.28 % | \n",
" 36.89 % | \n",
" 0.7828 | \n",
" 0.3689 | \n",
" 191 | \n",
" 90 | \n",
" 101 | \n",
" 0.2172 | \n",
" 0.4139 | \n",
"
\n",
" \n",
" 16 | \n",
" M'TSANGAMOUJI | \n",
" M tsangamouji | \n",
" 264 | \n",
" 79.17 % | \n",
" 35.23 % | \n",
" 0.7917 | \n",
" 0.3523 | \n",
" 209 | \n",
" 93 | \n",
" 116 | \n",
" 0.2083 | \n",
" 0.4394 | \n",
"
\n",
" \n",
" 17 | \n",
" ZAKIA MADI | \n",
" Dembeni | \n",
" 406 | \n",
" 77.09 % | \n",
" 34.98 % | \n",
" 0.7709 | \n",
" 0.3498 | \n",
" 312 | \n",
" 142 | \n",
" 170 | \n",
" 0.2291 | \n",
" 0.4211 | \n",
"
\n",
" \n",
"
\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": 21,
"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": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dnb2017.columns"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"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": 26,
"metadata": {},
"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": 29,
"metadata": {},
"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": 34,
"metadata": {},
"outputs": [],
"source": [
"dnb2017_ville = dnb2017_ville.reset_index()"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Ville | \n",
" Présents\n",
"au DNB | \n",
" nbr_admis | \n",
" nbr_mentions | \n",
" nbr_sans_mentions | \n",
" nbr_non_admis | \n",
" tx_avec_mention | \n",
" tx_non_admis | \n",
" tx_sans_mention | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Bandraboua | \n",
" 244 | \n",
" 191 | \n",
" 90 | \n",
" 101 | \n",
" 53 | \n",
" 36.885246 | \n",
" 21.721311 | \n",
" 41.393443 | \n",
"
\n",
" \n",
" 1 | \n",
" Bandrele | \n",
" 176 | \n",
" 138 | \n",
" 84 | \n",
" 54 | \n",
" 38 | \n",
" 47.727273 | \n",
" 21.590909 | \n",
" 30.681818 | \n",
"
\n",
" \n",
" 2 | \n",
" Chiconi | \n",
" 348 | \n",
" 280 | \n",
" 140 | \n",
" 140 | \n",
" 68 | \n",
" 40.229885 | \n",
" 19.540230 | \n",
" 40.229885 | \n",
"
\n",
" \n",
" 3 | \n",
" Chirongui | \n",
" 303 | \n",
" 257 | \n",
" 134 | \n",
" 123 | \n",
" 46 | \n",
" 44.224422 | \n",
" 15.181518 | \n",
" 40.594059 | \n",
"
\n",
" \n",
" 4 | \n",
" Dembeni | \n",
" 406 | \n",
" 312 | \n",
" 142 | \n",
" 170 | \n",
" 94 | \n",
" 34.975369 | \n",
" 23.152709 | \n",
" 41.871921 | \n",
"
\n",
" \n",
" 5 | \n",
" Dzaoudzi | \n",
" 352 | \n",
" 278 | \n",
" 144 | \n",
" 134 | \n",
" 74 | \n",
" 40.909091 | \n",
" 21.022727 | \n",
" 38.068182 | \n",
"
\n",
" \n",
" 6 | \n",
" Kani keli | \n",
" 158 | \n",
" 134 | \n",
" 75 | \n",
" 59 | \n",
" 24 | \n",
" 47.468354 | \n",
" 15.189873 | \n",
" 37.341772 | \n",
"
\n",
" \n",
" 7 | \n",
" Koungou | \n",
" 400 | \n",
" 328 | \n",
" 155 | \n",
" 173 | \n",
" 72 | \n",
" 38.750000 | \n",
" 18.000000 | \n",
" 43.250000 | \n",
"
\n",
" \n",
" 8 | \n",
" M tsangamouji | \n",
" 264 | \n",
" 209 | \n",
" 93 | \n",
" 116 | \n",
" 55 | \n",
" 35.227273 | \n",
" 20.833333 | \n",
" 43.939394 | \n",
"
\n",
" \n",
" 9 | \n",
" Mamoudzou | \n",
" 1733 | \n",
" 1430 | \n",
" 754 | \n",
" 676 | \n",
" 303 | \n",
" 43.508367 | \n",
" 17.484132 | \n",
" 39.007501 | \n",
"
\n",
" \n",
" 10 | \n",
" Mtsamboro | \n",
" 203 | \n",
" 153 | \n",
" 87 | \n",
" 66 | \n",
" 50 | \n",
" 42.857143 | \n",
" 24.630542 | \n",
" 32.512315 | \n",
"
\n",
" \n",
" 11 | \n",
" Pamandzi | \n",
" 348 | \n",
" 255 | \n",
" 152 | \n",
" 103 | \n",
" 93 | \n",
" 43.678161 | \n",
" 26.724138 | \n",
" 29.597701 | \n",
"
\n",
" \n",
" 12 | \n",
" Sada | \n",
" 229 | \n",
" 187 | \n",
" 113 | \n",
" 74 | \n",
" 42 | \n",
" 49.344978 | \n",
" 18.340611 | \n",
" 32.314410 | \n",
"
\n",
" \n",
" 13 | \n",
" Tsingoni | \n",
" 275 | \n",
" 209 | \n",
" 110 | \n",
" 99 | \n",
" 66 | \n",
" 40.000000 | \n",
" 24.000000 | \n",
" 36.000000 | \n",
"
\n",
" \n",
"
\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": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dnb2017_ville"
]
},
{
"cell_type": "code",
"execution_count": 65,
"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": 66,
"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": 66,
"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": 13,
"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",
""
]
},
"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": "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
}