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

1472 lines
69 KiB
Plaintext

{
"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,
"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": [
"<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,
"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": [
"<?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_data_text\": \"No data\", \"no_prefix\": false, \"order_min\": null, \"pretty_print\": false, \"print_labels\": false, \"print_values\": false, \"print_values_position\": \"center\", \"print_zeroes\": true, \"range\": null, \"rounded_bars\": null, \"secondary_range\": null, \"show_dots\": true, \"show_legend\": true, \"show_minor_x_labels\": true, \"show_minor_y_labels\": true, \"show_only_major_dots\": false, \"show_x_guides\": true, \"show_x_labels\": true, \"show_y_guides\": false, \"show_y_labels\": true, \"spacing\": 10, \"stack_from_top\": false, \"strict\": false, \"stroke\": true, \"stroke_style\": null, \"style\": {\"background\": \"#00000000\", \"ci_colors\": [], \"colors\": [\"#d94e4c\", \"#e5884f\", \"#39929a\", \"#e27876\", \"#245d62\", \"#f0bb9b\", \"#c82d2a\", \"#234547\"], \"font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"foreground\": \"rgba(0, 0, 0, 0.9)\", \"foreground_strong\": \"rgba(0, 0, 0, 0.9)\", \"foreground_subtle\": \"rgba(0, 0, 0, 0.5)\", \"guide_stroke_dasharray\": \"4,4\", \"label_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"label_font_size\": 10, \"legend_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"legend_font_size\": 14, \"major_guide_stroke_dasharray\": \"6,6\", \"major_label_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"major_label_font_size\": 10, \"no_data_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"no_data_font_size\": 64, \"opacity\": \".6\", \"opacity_hover\": \".9\", \"plot_background\": \"#00000000\", \"stroke_opacity\": \".8\", \"stroke_opacity_hover\": \".9\", \"title_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"title_font_size\": 20, \"tooltip_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"tooltip_font_size\": 14, \"transition\": \"150ms\", \"value_background\": \"rgba(229, 229, 229, 1)\", \"value_colors\": [], \"value_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"value_font_size\": 16, \"value_label_font_family\": \"Consolas, \\\"Liberation Mono\\\", Menlo, Courier, monospace\", \"value_label_font_size\": 20}, \"title\": null, \"tooltip_border_radius\": 0, \"tooltip_fancy_mode\": true, \"truncate_label\": null, \"truncate_legend\": null, \"width\": 800, \"x_label_rotation\": 0, \"x_labels\": [\"SADA\", \"KANI-KELI\", \"BANDRELE\", \"PASSAMAINTY\", \"KAWENI 1\", \"KAWENI 2\", \"TSIMKOURA\", \"ZENA M'DERE\", \"MTSAMBORO\", \"NELSON MANDELA\", \"BOUENI M TITI\", \"ALI HALIDI\", \"TSINGONI\", \"KOUNGOU\", \"M'GOMBANI\", \"DZOUMOGNE\", \"M'TSANGAMOUJI\", \"ZAKIA MADI\"], \"x_labels_major\": null, \"x_labels_major_count\": null, \"x_labels_major_every\": null, \"x_title\": null, \"xrange\": null, \"y_label_rotation\": 0, \"y_labels\": null, \"y_labels_major\": null, \"y_labels_major_count\": null, \"y_labels_major_every\": null, \"y_title\": null, \"zero\": 0, \"legends\": [\"Nombre d'admis\"]}</script><script type=\"text/javascript\" xlink:href=\"https://kozea.github.io/pygal.js/2.0.x/pygal-tooltips.min.js\"/></defs><title>Pygal</title><g class=\"graph horizontalbar-graph horizontal\"><rect class=\"background\" height=\"600\" width=\"800\" x=\"0\" y=\"0\"/><g class=\"plot\" transform=\"translate(253, 20)\"><rect class=\"background\" height=\"540\" width=\"526.4\" x=\"0\" y=\"0\"/><g class=\"axis y\"><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"518.6923076923077\">SADA</text><title>0.02777777778</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"489.84615384615387\">KANI-KELI</text><title>0.08333333333</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"461.0\">BANDRELE</text><title>0.1388888889</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"432.1538461538462\">PASSAMAINTY</text><title>0.1944444444</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"403.30769230769226\">KAWENI 1</text><title>0.25</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"374.46153846153845\">KAWENI 2</text><title>0.3055555556</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"345.61538461538464\">TSIMKOURA</text><title>0.3611111111</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"316.7692307692308\">ZENA M'DERE</text><title>0.4166666667</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"287.9230769230769\">MTSAMBORO</text><title>0.4722222222</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"259.0769230769231\">NELSON MANDELA</text><title>0.5277777778</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"230.23076923076923\">BOUENI M TITI</text><title>0.5833333333</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"201.38461538461542\">ALI HALIDI</text><title>0.6388888889</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"172.53846153846155\">TSINGONI</text><title>0.6944444444</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"143.69230769230768\">KOUNGOU</text><title>0.75</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"114.84615384615387\">M'GOMBANI</text><title>0.8055555556</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"86.0\">DZOUMOGNE</text><title>0.8611111111</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"57.15384615384613\">M'TSANGAMOUJI</text><title>0.9166666667</title></g><g class=\"guides\"><text class=\"\" x=\"-5\" y=\"28.307692307692378\">ZAKIA MADI</text><title>0.9722222222</title></g></g><g class=\"axis x always_show\"><g class=\"guides\"><path class=\"axis major line\" d=\"M10.123077 0.000000 v540.000000\"/><text class=\"major\" x=\"10.1230769231\" y=\"555.0\">0</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M71.849156 0.000000 v540.000000\"/><text class=\"\" x=\"71.8491557223\" y=\"555.0\">40</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M133.575235 0.000000 v540.000000\"/><text class=\"\" x=\"133.575234522\" y=\"555.0\">80</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M195.301313 0.000000 v540.000000\"/><text class=\"\" x=\"195.301313321\" y=\"555.0\">120</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M257.027392 0.000000 v540.000000\"/><text class=\"\" x=\"257.02739212\" y=\"555.0\">160</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M318.753471 0.000000 v540.000000\"/><text class=\"\" x=\"318.753470919\" y=\"555.0\">200</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M380.479550 0.000000 v540.000000\"/><text class=\"\" x=\"380.479549719\" y=\"555.0\">240</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M442.205629 0.000000 v540.000000\"/><text class=\"\" x=\"442.205628518\" y=\"555.0\">280</text></g><g class=\"guides\"><path class=\"guide line\" d=\"M503.931707 0.000000 v540.000000\"/><text class=\"\" x=\"503.931707317\" y=\"555.0\">320</text></g></g><g class=\"series serie-0 color-0\"><g class=\"bars\"><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"288.569418386\" x=\"10.1230769231\" y=\"504.02307692307687\"/><desc class=\"value\">187</desc><desc class=\"x centered\">154.407786116</desc><desc class=\"y centered\">515.1923076923076</desc><desc class=\"x_label\">SADA</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"206.782363977\" x=\"10.1230769231\" y=\"475.17692307692306\"/><desc class=\"value\">134</desc><desc class=\"x centered\">113.514258912</desc><desc class=\"y centered\">486.34615384615387</desc><desc class=\"x_label\">KANI-KELI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"212.954971857\" x=\"10.1230769231\" y=\"446.3307692307692\"/><desc class=\"value\">138</desc><desc class=\"x centered\">116.600562852</desc><desc class=\"y centered\">457.5</desc><desc class=\"x_label\">BANDRELE</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"462.945590994\" x=\"10.1230769231\" y=\"417.4846153846154\"/><desc class=\"value\">300</desc><desc class=\"x centered\">241.59587242</desc><desc class=\"y centered\">428.6538461538462</desc><desc class=\"x_label\">PASSAMAINTY</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"445.970919325\" x=\"10.1230769231\" y=\"388.63846153846157\"/><desc class=\"value\">289</desc><desc class=\"x centered\">233.108536585</desc><desc class=\"y centered\">399.8076923076924</desc><desc class=\"x_label\">KAWENI 1</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"368.813320826\" x=\"10.1230769231\" y=\"359.79230769230765\"/><desc class=\"value\">239</desc><desc class=\"x centered\">194.529737336</desc><desc class=\"y centered\">370.96153846153845</desc><desc class=\"x_label\">KAWENI 2</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"396.590056285\" x=\"10.1230769231\" y=\"330.94615384615383\"/><desc class=\"value\">257</desc><desc class=\"x centered\">208.418105066</desc><desc class=\"y centered\">342.11538461538464</desc><desc class=\"x_label\">TSIMKOURA</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"393.503752345\" x=\"10.1230769231\" y=\"302.09999999999997\"/><desc class=\"value\">255</desc><desc class=\"x centered\">206.874953096</desc><desc class=\"y centered\">313.2692307692308</desc><desc class=\"x_label\">ZENA M'DERE</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"236.102251407\" x=\"10.1230769231\" y=\"273.25384615384615\"/><desc class=\"value\">153</desc><desc class=\"x centered\">128.174202627</desc><desc class=\"y centered\">284.42307692307696</desc><desc class=\"x_label\">MTSAMBORO</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"490.722326454\" x=\"10.1230769231\" y=\"244.40769230769232\"/><desc class=\"value\">318</desc><desc class=\"x centered\">255.48424015</desc><desc class=\"y centered\">255.57692307692307</desc><desc class=\"x_label\">NELSON MANDELA</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"428.996247655\" x=\"10.1230769231\" y=\"215.56153846153845\"/><desc class=\"value\">278</desc><desc class=\"x centered\">224.62120075</desc><desc class=\"y centered\">226.7307692307692</desc><desc class=\"x_label\">BOUENI M TITI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"432.082551595\" x=\"10.1230769231\" y=\"186.71538461538464\"/><desc class=\"value\">280</desc><desc class=\"x centered\">226.16435272</desc><desc class=\"y centered\">197.8846153846154</desc><desc class=\"x_label\">ALI HALIDI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"322.518761726\" x=\"10.1230769231\" y=\"157.86923076923077\"/><desc class=\"value\">209</desc><desc class=\"x centered\">171.382457786</desc><desc class=\"y centered\">169.03846153846152</desc><desc class=\"x_label\">TSINGONI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"506.153846154\" x=\"10.1230769231\" y=\"129.02307692307696\"/><desc class=\"value\">328</desc><desc class=\"x centered\">263.2</desc><desc class=\"y centered\">140.1923076923077</desc><desc class=\"x_label\">KOUNGOU</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"438.255159475\" x=\"10.1230769231\" y=\"100.17692307692309\"/><desc class=\"value\">284</desc><desc class=\"x centered\">229.25065666</desc><desc class=\"y centered\">111.34615384615385</desc><desc class=\"x_label\">M'GOMBANI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"294.742026266\" x=\"10.1230769231\" y=\"71.33076923076922\"/><desc class=\"value\">191</desc><desc class=\"x centered\">157.494090056</desc><desc class=\"y centered\">82.49999999999999</desc><desc class=\"x_label\">DZOUMOGNE</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"322.518761726\" x=\"10.1230769231\" y=\"42.48461538461546\"/><desc class=\"value\">209</desc><desc class=\"x centered\">171.382457786</desc><desc class=\"y centered\">53.65384615384623</desc><desc class=\"x_label\">M'TSANGAMOUJI</desc></g><g class=\"bar\"><rect class=\"rect reactive tooltip-trigger\" height=\"22.338461538461537\" rx=\"0\" ry=\"0\" width=\"481.463414634\" x=\"10.1230769231\" y=\"13.638461538461591\"/><desc class=\"value\">312</desc><desc class=\"x centered\">250.85478424</desc><desc class=\"y centered\">24.80769230769236</desc><desc class=\"x_label\">ZAKIA MADI</desc></g></g></g></g><g class=\"titles\"/><g class=\"plot overlay\" transform=\"translate(253, 20)\"><g class=\"series serie-0 color-0\"/></g><g class=\"plot text-overlay\" transform=\"translate(253, 20)\"><g class=\"series serie-0 color-0\"/></g><g class=\"plot tooltip-overlay\" transform=\"translate(253, 20)\"><g class=\"tooltip\" style=\"opacity: 0\" transform=\"translate(0 0)\"><rect class=\"tooltip-box\" height=\"0\" rx=\"0\" ry=\"0\" width=\"0\"/><g class=\"text\"/></g></g><g class=\"legends\" transform=\"translate(10, 30)\"><g class=\"legend reactive activate-serie\" id=\"activate-serie-0\"><rect class=\"color-0 reactive\" height=\"12\" width=\"12\" x=\"0.0\" y=\"1.0\"/><text x=\"17.0\" y=\"11.2\">Nombre d'admis</text></g></g><g class=\"legends\" transform=\"translate(790, 30)\"/></g></svg>"
]
},
"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))"
]
},
{
"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
}