2017-2018/3ePasserelles/Gestion_donnees/Lecture_tableau_graphiques/Resultats DNB 2017 Mayotte....

1472 lines
69 KiB
Plaintext
Raw Normal View History

2017-09-20 16:38:04 +00:00
{
"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": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Collège</th>\n",
" <th>Ville</th>\n",
" <th>Présents\n",
"au DNB</th>\n",
" <th>Taux de réussite</th>\n",
" <th>Taux de mentions</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>SADA</td>\n",
" <td>Sada</td>\n",
" <td>229</td>\n",
" <td>81.66 %</td>\n",
" <td>49.78 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>KANI-KELI</td>\n",
" <td>Kani keli</td>\n",
" <td>158</td>\n",
" <td>85.44 %</td>\n",
" <td>48.10 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>BANDRELE</td>\n",
" <td>Bandrele</td>\n",
" <td>176</td>\n",
" <td>78.41 %</td>\n",
" <td>47.73 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>PASSAMAINTY</td>\n",
" <td>Mamoudzou</td>\n",
" <td>344</td>\n",
" <td>87.21 %</td>\n",
" <td>47.67 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>KAWENI 1</td>\n",
" <td>Mamoudzou</td>\n",
" <td>333</td>\n",
" <td>86.79 %</td>\n",
" <td>47.15 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>KAWENI 2</td>\n",
" <td>Mamoudzou</td>\n",
" <td>273</td>\n",
" <td>87.91 %</td>\n",
" <td>45.79 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>TSIMKOURA</td>\n",
" <td>Chirongui</td>\n",
" <td>303</td>\n",
" <td>84.82 %</td>\n",
" <td>44.55 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>ZENA M'DERE</td>\n",
" <td>Pamandzi</td>\n",
" <td>348</td>\n",
" <td>73.28 %</td>\n",
" <td>43.68 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>MTSAMBORO</td>\n",
" <td>Mtsamboro</td>\n",
" <td>203</td>\n",
" <td>75.37 %</td>\n",
" <td>42.86 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>NELSON MANDELA</td>\n",
" <td>Mamoudzou</td>\n",
" <td>398</td>\n",
" <td>80.15 %</td>\n",
" <td>41.71 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>BOUENI M TITI</td>\n",
" <td>Dzaoudzi</td>\n",
" <td>352</td>\n",
" <td>79.26 %</td>\n",
" <td>41.19 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>ALI HALIDI</td>\n",
" <td>Chiconi</td>\n",
" <td>348</td>\n",
" <td>80.46 %</td>\n",
" <td>40.23 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>TSINGONI</td>\n",
" <td>Tsingoni</td>\n",
" <td>275</td>\n",
" <td>76.36 %</td>\n",
" <td>40.00 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>KOUNGOU</td>\n",
" <td>Koungou</td>\n",
" <td>400</td>\n",
" <td>82.00 %</td>\n",
" <td>38.75 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>M'GOMBANI</td>\n",
" <td>Mamoudzou</td>\n",
" <td>385</td>\n",
" <td>73.77 %</td>\n",
" <td>37.40 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>DZOUMOGNE</td>\n",
" <td>Bandraboua</td>\n",
" <td>244</td>\n",
" <td>78.28 %</td>\n",
" <td>36.89 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>M'TSANGAMOUJI</td>\n",
" <td>M tsangamouji</td>\n",
" <td>264</td>\n",
" <td>79.17 %</td>\n",
" <td>35.23 %</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>ZAKIA MADI</td>\n",
" <td>Dembeni</td>\n",
" <td>406</td>\n",
" <td>77.09 %</td>\n",
" <td>34.98 %</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Collège</th>\n",
" <th>Ville</th>\n",
" <th>Présents\n",
"au DNB</th>\n",
" <th>Taux de réussite</th>\n",
" <th>Taux de mentions</th>\n",
" <th>tx_admis</th>\n",
" <th>tx_mention</th>\n",
" <th>nbr_admis</th>\n",
" <th>nbr_mentions</th>\n",
" <th>nbr_sans_mentions</th>\n",
" <th>tx_non_admis</th>\n",
" <th>tx_sans_mention</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>SADA</td>\n",
" <td>Sada</td>\n",
" <td>229</td>\n",
" <td>81.66 %</td>\n",
" <td>49.78 %</td>\n",
" <td>0.8166</td>\n",
" <td>0.4978</td>\n",
" <td>187</td>\n",
" <td>113</td>\n",
" <td>74</td>\n",
" <td>0.1834</td>\n",
" <td>0.3188</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>KANI-KELI</td>\n",
" <td>Kani keli</td>\n",
" <td>158</td>\n",
" <td>85.44 %</td>\n",
" <td>48.10 %</td>\n",
" <td>0.8544</td>\n",
" <td>0.4810</td>\n",
" <td>134</td>\n",
" <td>75</td>\n",
" <td>59</td>\n",
" <td>0.1456</td>\n",
" <td>0.3734</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>BANDRELE</td>\n",
" <td>Bandrele</td>\n",
" <td>176</td>\n",
" <td>78.41 %</td>\n",
" <td>47.73 %</td>\n",
" <td>0.7841</td>\n",
" <td>0.4773</td>\n",
" <td>138</td>\n",
" <td>84</td>\n",
" <td>54</td>\n",
" <td>0.2159</td>\n",
" <td>0.3068</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>PASSAMAINTY</td>\n",
" <td>Mamoudzou</td>\n",
" <td>344</td>\n",
" <td>87.21 %</td>\n",
" <td>47.67 %</td>\n",
" <td>0.8721</td>\n",
" <td>0.4767</td>\n",
" <td>300</td>\n",
" <td>163</td>\n",
" <td>137</td>\n",
" <td>0.1279</td>\n",
" <td>0.3954</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>KAWENI 1</td>\n",
" <td>Mamoudzou</td>\n",
" <td>333</td>\n",
" <td>86.79 %</td>\n",
" <td>47.15 %</td>\n",
" <td>0.8679</td>\n",
" <td>0.4715</td>\n",
" <td>289</td>\n",
" <td>157</td>\n",
" <td>132</td>\n",
" <td>0.1321</td>\n",
" <td>0.3964</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>KAWENI 2</td>\n",
" <td>Mamoudzou</td>\n",
" <td>273</td>\n",
" <td>87.91 %</td>\n",
" <td>45.79 %</td>\n",
" <td>0.8791</td>\n",
" <td>0.4579</td>\n",
" <td>239</td>\n",
" <td>125</td>\n",
" <td>114</td>\n",
" <td>0.1209</td>\n",
" <td>0.4212</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>TSIMKOURA</td>\n",
" <td>Chirongui</td>\n",
" <td>303</td>\n",
" <td>84.82 %</td>\n",
" <td>44.55 %</td>\n",
" <td>0.8482</td>\n",
" <td>0.4455</td>\n",
" <td>257</td>\n",
" <td>134</td>\n",
" <td>123</td>\n",
" <td>0.1518</td>\n",
" <td>0.4027</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>ZENA M'DERE</td>\n",
" <td>Pamandzi</td>\n",
" <td>348</td>\n",
" <td>73.28 %</td>\n",
" <td>43.68 %</td>\n",
" <td>0.7328</td>\n",
" <td>0.4368</td>\n",
" <td>255</td>\n",
" <td>152</td>\n",
" <td>103</td>\n",
" <td>0.2672</td>\n",
" <td>0.2960</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>MTSAMBORO</td>\n",
" <td>Mtsamboro</td>\n",
" <td>203</td>\n",
" <td>75.37 %</td>\n",
" <td>42.86 %</td>\n",
" <td>0.7537</td>\n",
" <td>0.4286</td>\n",
" <td>153</td>\n",
" <td>87</td>\n",
" <td>66</td>\n",
" <td>0.2463</td>\n",
" <td>0.3251</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>NELSON MANDELA</td>\n",
" <td>Mamoudzou</td>\n",
" <td>398</td>\n",
" <td>80.15 %</td>\n",
" <td>41.71 %</td>\n",
" <td>0.8015</td>\n",
" <td>0.4171</td>\n",
" <td>318</td>\n",
" <td>166</td>\n",
" <td>152</td>\n",
" <td>0.1985</td>\n",
" <td>0.3844</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>BOUENI M TITI</td>\n",
" <td>Dzaoudzi</td>\n",
" <td>352</td>\n",
" <td>79.26 %</td>\n",
" <td>41.19 %</td>\n",
" <td>0.7926</td>\n",
" <td>0.4119</td>\n",
" <td>278</td>\n",
" <td>144</td>\n",
" <td>134</td>\n",
" <td>0.2074</td>\n",
" <td>0.3807</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>ALI HALIDI</td>\n",
" <td>Chiconi</td>\n",
" <td>348</td>\n",
" <td>80.46 %</td>\n",
" <td>40.23 %</td>\n",
" <td>0.8046</td>\n",
" <td>0.4023</td>\n",
" <td>280</td>\n",
" <td>140</td>\n",
" <td>140</td>\n",
" <td>0.1954</td>\n",
" <td>0.4023</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>TSINGONI</td>\n",
" <td>Tsingoni</td>\n",
" <td>275</td>\n",
" <td>76.36 %</td>\n",
" <td>40.00 %</td>\n",
" <td>0.7636</td>\n",
" <td>0.4000</td>\n",
" <td>209</td>\n",
" <td>110</td>\n",
" <td>99</td>\n",
" <td>0.2364</td>\n",
" <td>0.3636</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>KOUNGOU</td>\n",
" <td>Koungou</td>\n",
" <td>400</td>\n",
" <td>82.00 %</td>\n",
" <td>38.75 %</td>\n",
" <td>0.8200</td>\n",
" <td>0.3875</td>\n",
" <td>328</td>\n",
" <td>155</td>\n",
" <td>173</td>\n",
" <td>0.1800</td>\n",
" <td>0.4325</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>M'GOMBANI</td>\n",
" <td>Mamoudzou</td>\n",
" <td>385</td>\n",
" <td>73.77 %</td>\n",
" <td>37.40 %</td>\n",
" <td>0.7377</td>\n",
" <td>0.3740</td>\n",
" <td>284</td>\n",
" <td>143</td>\n",
" <td>141</td>\n",
" <td>0.2623</td>\n",
" <td>0.3637</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>DZOUMOGNE</td>\n",
" <td>Bandraboua</td>\n",
" <td>244</td>\n",
" <td>78.28 %</td>\n",
" <td>36.89 %</td>\n",
" <td>0.7828</td>\n",
" <td>0.3689</td>\n",
" <td>191</td>\n",
" <td>90</td>\n",
" <td>101</td>\n",
" <td>0.2172</td>\n",
" <td>0.4139</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>M'TSANGAMOUJI</td>\n",
" <td>M tsangamouji</td>\n",
" <td>264</td>\n",
" <td>79.17 %</td>\n",
" <td>35.23 %</td>\n",
" <td>0.7917</td>\n",
" <td>0.3523</td>\n",
" <td>209</td>\n",
" <td>93</td>\n",
" <td>116</td>\n",
" <td>0.2083</td>\n",
" <td>0.4394</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>ZAKIA MADI</td>\n",
" <td>Dembeni</td>\n",
" <td>406</td>\n",
" <td>77.09 %</td>\n",
" <td>34.98 %</td>\n",
" <td>0.7709</td>\n",
" <td>0.3498</td>\n",
" <td>312</td>\n",
" <td>142</td>\n",
" <td>170</td>\n",
" <td>0.2291</td>\n",
" <td>0.4211</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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,
2017-09-20 16:38:04 +00:00
"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,
2017-09-20 16:38:04 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dnb2017.columns"
]
},
{
"cell_type": "code",
"execution_count": 11,
2017-09-20 16:38:04 +00:00
"metadata": {
"collapsed": true,
2017-09-20 16:38:04 +00:00
"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
},
2017-09-20 16:38:04 +00:00
"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
},
2017-09-20 16:38:04 +00:00
"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
},
2017-09-20 16:38:04 +00:00
"outputs": [],
"source": [
"dnb2017_ville = dnb2017_ville.reset_index()"
]
},
{
"cell_type": "code",
"execution_count": 15,
2017-09-20 16:38:04 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Ville</th>\n",
" <th>Présents\n",
"au DNB</th>\n",
" <th>nbr_admis</th>\n",
" <th>nbr_mentions</th>\n",
" <th>nbr_sans_mentions</th>\n",
" <th>nbr_non_admis</th>\n",
" <th>tx_avec_mention</th>\n",
" <th>tx_non_admis</th>\n",
" <th>tx_sans_mention</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Bandraboua</td>\n",
" <td>244</td>\n",
" <td>191</td>\n",
" <td>90</td>\n",
" <td>101</td>\n",
" <td>53</td>\n",
" <td>36.885246</td>\n",
" <td>21.721311</td>\n",
" <td>41.393443</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Bandrele</td>\n",
" <td>176</td>\n",
" <td>138</td>\n",
" <td>84</td>\n",
" <td>54</td>\n",
" <td>38</td>\n",
" <td>47.727273</td>\n",
" <td>21.590909</td>\n",
" <td>30.681818</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Chiconi</td>\n",
" <td>348</td>\n",
" <td>280</td>\n",
" <td>140</td>\n",
" <td>140</td>\n",
" <td>68</td>\n",
" <td>40.229885</td>\n",
" <td>19.540230</td>\n",
" <td>40.229885</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Chirongui</td>\n",
" <td>303</td>\n",
" <td>257</td>\n",
" <td>134</td>\n",
" <td>123</td>\n",
" <td>46</td>\n",
" <td>44.224422</td>\n",
" <td>15.181518</td>\n",
" <td>40.594059</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Dembeni</td>\n",
" <td>406</td>\n",
" <td>312</td>\n",
" <td>142</td>\n",
" <td>170</td>\n",
" <td>94</td>\n",
" <td>34.975369</td>\n",
" <td>23.152709</td>\n",
" <td>41.871921</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Dzaoudzi</td>\n",
" <td>352</td>\n",
" <td>278</td>\n",
" <td>144</td>\n",
" <td>134</td>\n",
" <td>74</td>\n",
" <td>40.909091</td>\n",
" <td>21.022727</td>\n",
" <td>38.068182</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Kani keli</td>\n",
" <td>158</td>\n",
" <td>134</td>\n",
" <td>75</td>\n",
" <td>59</td>\n",
" <td>24</td>\n",
" <td>47.468354</td>\n",
" <td>15.189873</td>\n",
" <td>37.341772</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Koungou</td>\n",
" <td>400</td>\n",
" <td>328</td>\n",
" <td>155</td>\n",
" <td>173</td>\n",
" <td>72</td>\n",
" <td>38.750000</td>\n",
" <td>18.000000</td>\n",
" <td>43.250000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>M tsangamouji</td>\n",
" <td>264</td>\n",
" <td>209</td>\n",
" <td>93</td>\n",
" <td>116</td>\n",
" <td>55</td>\n",
" <td>35.227273</td>\n",
" <td>20.833333</td>\n",
" <td>43.939394</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Mamoudzou</td>\n",
" <td>1733</td>\n",
" <td>1430</td>\n",
" <td>754</td>\n",
" <td>676</td>\n",
" <td>303</td>\n",
" <td>43.508367</td>\n",
" <td>17.484132</td>\n",
" <td>39.007501</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Mtsamboro</td>\n",
" <td>203</td>\n",
" <td>153</td>\n",
" <td>87</td>\n",
" <td>66</td>\n",
" <td>50</td>\n",
" <td>42.857143</td>\n",
" <td>24.630542</td>\n",
" <td>32.512315</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Pamandzi</td>\n",
" <td>348</td>\n",
" <td>255</td>\n",
" <td>152</td>\n",
" <td>103</td>\n",
" <td>93</td>\n",
" <td>43.678161</td>\n",
" <td>26.724138</td>\n",
" <td>29.597701</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Sada</td>\n",
" <td>229</td>\n",
" <td>187</td>\n",
" <td>113</td>\n",
" <td>74</td>\n",
" <td>42</td>\n",
" <td>49.344978</td>\n",
" <td>18.340611</td>\n",
" <td>32.314410</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Tsingoni</td>\n",
" <td>275</td>\n",
" <td>209</td>\n",
" <td>110</td>\n",
" <td>99</td>\n",
" <td>66</td>\n",
" <td>40.000000</td>\n",
" <td>24.000000</td>\n",
" <td>36.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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,
2017-09-20 16:38:04 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dnb2017_ville"
]
},
{
"cell_type": "code",
"execution_count": 16,
2017-09-20 16:38:04 +00:00
"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,
2017-09-20 16:38:04 +00:00
"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,
2017-09-20 16:38:04 +00:00
"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,
2017-09-20 16:38:04 +00:00
"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": [
"<?xml version='1.0' encoding='utf-8'?>\n",
"<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\" id=\"chart-0a49c004-e9ed-42a6-9870-fca983726340\" class=\"pygal-chart\" viewBox=\"0 0 800 600\"><!--Generated with pygal 2.4.0 (lxml) ©Kozea 2012-2016 on 2017-09-20--><!--http://pygal.org--><!--http://github.com/Kozea/pygal--><defs><style type=\"text/css\">#chart-0a49c004-e9ed-42a6-9870-fca983726340{-webkit-user-select:none;-webkit-font-smoothing:antialiased;font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .title{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:20px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .legends .legend text{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:14px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis text{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:10px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis text.major{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:10px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .text-overlay text.value{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:16px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .text-overlay text.label{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:20px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:14px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 text.no_data{font-family:Consolas,\"Liberation Mono\",Menlo,Courier,monospace;font-size:64px}\n",
"#chart-0a49c004-e9ed-42a6-9870-fca983726340{background-color:#00000000}#chart-0a49c004-e9ed-42a6-9870-fca983726340 path,#chart-0a49c004-e9ed-42a6-9870-fca983726340 line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 rect,#chart-0a49c004-e9ed-42a6-9870-fca983726340 circle{-webkit-transition:150ms;-moz-transition:150ms;transition:150ms}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .graph &gt; .background{fill:#00000000}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .plot &gt; .background{fill:#00000000}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .graph{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 text.no_data{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .title{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .legends .legend text{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .legends .legend:hover text{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .line{stroke:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .guide.line{stroke:rgba(0,0,0,0.5)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .major.line{stroke:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis text.major{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y .guides:hover .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .line-graph .axis.x .guides:hover .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .stackedline-graph .axis.x .guides:hover .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .xy-graph .axis.x .guides:hover .guide.line{stroke:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .guides:hover text{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .reactive{fill-opacity:.6;stroke-opacity:.8}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .ci{stroke:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .reactive.active,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .active .reactive{fill-opacity:.9;stroke-opacity:.9;stroke-width:4}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .ci .reactive.active{stroke-width:1.5}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .series text{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip rect{fill:#00000000;stroke:rgba(0,0,0,0.9);-webkit-transition:opacity 150ms;-moz-transition:opacity 150ms;transition:opacity 150ms}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .label{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .label{fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .legend{font-size:.8em;fill:rgba(0,0,0,0.5)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .x_label{font-size:.6em;fill:rgba(0,0,0,0.9)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .xlink{font-size:.5em;text-decoration:underline}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip .value{font-size:1.5em}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .bound{font-size:.5em}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .max-value{font-size:.75em;fill:rgba(0,0,0,0.5)}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .map-element{fill:#00000000;stroke:rgba(0,0,0,0.5) !important}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .map-element .reactive{fill-opacity:inherit;stroke-opacity:inherit}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .color-0,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .color-0 a:visited{stroke:#d94e4c;fill:#d94e4c}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .text-overlay .color-0 text{fill:black}\n",
"#chart-0a49c004-e9ed-42a6-9870-fca983726340 text.no_data{text-anchor:middle}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .guide.line{fill:none}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .centered{text-anchor:middle}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .title{text-anchor:middle}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .legends .legend text{fill-opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.x text{text-anchor:middle}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.x:not(.web) text[transform]{text-anchor:start}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.x:not(.web) text[transform].backwards{text-anchor:end}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y text{text-anchor:end}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y text[transform].backwards{text-anchor:start}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y2 text{text-anchor:start}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y2 text[transform].backwards{text-anchor:end}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .guide.line{stroke-dasharray:4,4}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .major.guide.line{stroke-dasharray:6,6}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .horizontal .axis.y .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .horizontal .axis.y2 .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .vertical .axis.x .guide.line{opacity:0}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .horizontal .axis.always_show .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .vertical .axis.always_show .guide.line{opacity:1 !important}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y .guides:hover .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.y2 .guides:hover .guide.line,#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis.x .guides:hover .guide.line{opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .axis .guides:hover text{opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .nofill{fill:none}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .subtle-fill{fill-opacity:.2}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .dot{stroke-width:1px;fill-opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .dot.active{stroke-width:5px}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .dot.negative{fill:transparent}#chart-0a49c004-e9ed-42a6-9870-fca983726340 text,#chart-0a49c004-e9ed-42a6-9870-fca983726340 tspan{stroke:none !important}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .series text.active{opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip rect{fill-opacity:.95;stroke-width:.5}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .tooltip text{fill-opacity:1}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .showable{visibility:hidden}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .showable.shown{visibility:visible}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .gauge-background{fill:rgba(229,229,229,1);stroke:none}#chart-0a49c004-e9ed-42a6-9870-fca983726340 .bg-lines{stroke:#00000000;stroke-width:2px}</style><script type=\"text/javascript\">window.pygal = window.pygal || {};window.pygal.config = window.pygal.config || {};window.pygal.config['0a49c004-e9ed-42a6-9870-fca983726340'] = {\"allow_interruptions\": false, \"box_mode\": \"extremes\", \"classes\": [\"pygal-chart\"], \"css\": [\"file://style.css\", \"file://graph.css\"], \"defs\": [], \"disable_xml_declaration\": false, \"dots_size\": 2.5, \"dynamic_print_values\": false, \"explicit_size\": false, \"fill\": false, \"force_uri_protocol\": \"https\", \"formatter\": null, \"half_pie\": false, \"height\": 600, \"include_x_axis\": false, \"inner_radius\": 0, \"interpolate\": null, \"interpolation_parameters\": {}, \"interpolation_precision\": 250, \"inverse_y_axis\": false, \"js\": [\"//kozea.github.io/pygal.js/2.0.x/pygal-tooltips.min.js\"], \"legend_at_bottom\": false, \"legend_at_bottom_columns\": null, \"legend_box_size\": 12, \"logarithmic\": false, \"margin\": 20, \"margin_bottom\": null, \"margin_left\": null, \"margin_right\": null, \"margin_top\": null, \"max_scale\": 16, \"min_scale\": 4, \"missing_value_fill_truncation\": \"x\", \"no_da
]
},
"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": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Collège</th>\n",
" <th>Ville</th>\n",
" <th>Présents\n",
"au DNB</th>\n",
" <th>Taux de réussite</th>\n",
" <th>Taux de mentions</th>\n",
" <th>tx_admis</th>\n",
" <th>tx_mention</th>\n",
" <th>nbr_admis</th>\n",
" <th>nbr_mentions</th>\n",
" <th>nbr_sans_mentions</th>\n",
" <th>tx_non_admis</th>\n",
" <th>tx_sans_mention</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>SADA</td>\n",
" <td>Sada</td>\n",
" <td>229</td>\n",
" <td>81.66 %</td>\n",
" <td>49.78 %</td>\n",
" <td>0.8166</td>\n",
" <td>0.4978</td>\n",
" <td>187</td>\n",
" <td>113</td>\n",
" <td>74</td>\n",
" <td>0.1834</td>\n",
" <td>0.3188</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>KANI-KELI</td>\n",
" <td>Kani keli</td>\n",
" <td>158</td>\n",
" <td>85.44 %</td>\n",
" <td>48.10 %</td>\n",
" <td>0.8544</td>\n",
" <td>0.4810</td>\n",
" <td>134</td>\n",
" <td>75</td>\n",
" <td>59</td>\n",
" <td>0.1456</td>\n",
" <td>0.3734</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>BANDRELE</td>\n",
" <td>Bandrele</td>\n",
" <td>176</td>\n",
" <td>78.41 %</td>\n",
" <td>47.73 %</td>\n",
" <td>0.7841</td>\n",
" <td>0.4773</td>\n",
" <td>138</td>\n",
" <td>84</td>\n",
" <td>54</td>\n",
" <td>0.2159</td>\n",
" <td>0.3068</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>PASSAMAINTY</td>\n",
" <td>Mamoudzou</td>\n",
" <td>344</td>\n",
" <td>87.21 %</td>\n",
" <td>47.67 %</td>\n",
" <td>0.8721</td>\n",
" <td>0.4767</td>\n",
" <td>300</td>\n",
" <td>163</td>\n",
" <td>137</td>\n",
" <td>0.1279</td>\n",
" <td>0.3954</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>KAWENI 1</td>\n",
" <td>Mamoudzou</td>\n",
" <td>333</td>\n",
" <td>86.79 %</td>\n",
" <td>47.15 %</td>\n",
" <td>0.8679</td>\n",
" <td>0.4715</td>\n",
" <td>289</td>\n",
" <td>157</td>\n",
" <td>132</td>\n",
" <td>0.1321</td>\n",
" <td>0.3964</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Collège</th>\n",
" <th>nbr_mentions</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>NELSON MANDELA</td>\n",
" <td>166</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>PASSAMAINTY</td>\n",
" <td>163</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>KAWENI 1</td>\n",
" <td>157</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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))"
]
},
2017-09-20 16:38:04 +00:00
{
"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
}