2917 lines
97 KiB
Plaintext
2917 lines
97 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"import xlsxwriter"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"from repytex.worksheets.worksheet import pull_datas\n",
|
||
"from repytex.reports.eval import pull_datas as pull_sqlite\n",
|
||
"import pandas as pd\n",
|
||
"import numpy as np\n",
|
||
"import sqlite3"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"conn = sqlite3.connect('./recopytex.db')"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"# to xlxs"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 180,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"{'evaluation': id name term t_id\n",
|
||
" 0 1 DS1 mise en jambe 1 1,\n",
|
||
" 'exercises': id name eval_id date comment\n",
|
||
" 0 1 1 - Prendre la température 1 2017-09-05 00:00:00.000000 \n",
|
||
" 1 2 2 - Maladroite! 1 2017-09-05 00:00:00.000000 ,\n",
|
||
" 'question_scores': id question_id student_id value\n",
|
||
" 0 1 1 1 1\n",
|
||
" 1 2 2 1 2\n",
|
||
" 2 3 3 1 .\n",
|
||
" 3 4 1 2 2\n",
|
||
" 4 5 2 2 2\n",
|
||
" 5 6 3 2 1\n",
|
||
" 6 7 1 3 3\n",
|
||
" 7 8 2 3 0\n",
|
||
" 8 9 3 3 0\n",
|
||
" 9 10 1 4 3\n",
|
||
" 10 11 2 4 3\n",
|
||
" 11 12 3 4 0\n",
|
||
" 12 13 1 5 1\n",
|
||
" 13 14 2 5 2\n",
|
||
" 14 15 3 5 .\n",
|
||
" 15 16 1 6 3\n",
|
||
" 16 17 2 6 2\n",
|
||
" 17 18 3 6 0\n",
|
||
" 18 19 1 7 2\n",
|
||
" 19 20 2 7 2\n",
|
||
" 20 21 3 7 2\n",
|
||
" 21 22 1 9 2\n",
|
||
" 22 23 2 9 1\n",
|
||
" 23 24 3 9 2\n",
|
||
" 24 25 1 8 3\n",
|
||
" 25 26 2 8 1\n",
|
||
" 26 27 3 8 .\n",
|
||
" 27 28 1 10 1\n",
|
||
" 28 29 2 10 2\n",
|
||
" 29 30 3 10 0\n",
|
||
" .. ... ... ... ...\n",
|
||
" 178 803 4 21 .\n",
|
||
" 179 804 5 21 .\n",
|
||
" 180 805 6 21 .\n",
|
||
" 181 806 7 21 .\n",
|
||
" 182 807 8 21 .\n",
|
||
" 183 808 4 22 0\n",
|
||
" 184 809 5 22 .\n",
|
||
" 185 810 6 22 .\n",
|
||
" 186 811 7 22 .\n",
|
||
" 187 812 8 22 .\n",
|
||
" 188 813 4 23 3\n",
|
||
" 189 814 5 23 1\n",
|
||
" 190 815 6 23 1\n",
|
||
" 191 816 7 23 1\n",
|
||
" 192 817 8 23 1\n",
|
||
" 193 818 4 25 .\n",
|
||
" 194 819 5 25 .\n",
|
||
" 195 820 6 25 .\n",
|
||
" 196 821 7 25 .\n",
|
||
" 197 822 8 25 1\n",
|
||
" 198 823 4 24 3\n",
|
||
" 199 824 5 24 3\n",
|
||
" 200 825 6 24 3\n",
|
||
" 201 826 7 24 2\n",
|
||
" 202 827 8 24 2\n",
|
||
" 203 828 4 26 3\n",
|
||
" 204 829 5 26 3\n",
|
||
" 205 830 6 26 3\n",
|
||
" 206 831 7 26 3\n",
|
||
" 207 832 8 26 3\n",
|
||
" \n",
|
||
" [200 rows x 4 columns],\n",
|
||
" 'questions': id name score_rate is_leveled exercise_id competence domain \\\n",
|
||
" 0 1 1 0 1 1 Cher Grandeurs \n",
|
||
" 1 2 2 0 1 1 Cal Grandeurs \n",
|
||
" 2 3 2.c 0 1 1 Cal Grandeurs \n",
|
||
" 0 4 0 1 2 Cher 4opérations \n",
|
||
" 1 5 0 1 2 Cher 4opérations \n",
|
||
" 2 6 0 1 2 Rai 4opérations \n",
|
||
" 3 7 0 1 2 Cal 4opérations \n",
|
||
" 4 8 0 1 2 Com 4opérations \n",
|
||
" \n",
|
||
" comment \n",
|
||
" 0 Lecture du thermomètre \n",
|
||
" 1 Suivre programme de calculs \n",
|
||
" 2 Renverser un programme de calculs \n",
|
||
" 0 Lire le tableau et le graphique \n",
|
||
" 1 Décomposer le problème \n",
|
||
" 2 Manipuler les grandeurs \n",
|
||
" 3 Mener à bien les calculs \n",
|
||
" 4 Rédaction ,\n",
|
||
" 'students': id name surname mail commment tribe_id\n",
|
||
" 0 1 ABDALLAH ALLAOUI Taiassima None 1\n",
|
||
" 1 2 ADANI Ismou None 1\n",
|
||
" 2 3 AHAMADA Dhoulkamal None 1\n",
|
||
" 3 4 AHAMADI Asbahati None 1\n",
|
||
" 4 5 AHAMADI OUSSENI Ansufiddine None 1\n",
|
||
" 5 6 AHAMED Fayadhi None 1\n",
|
||
" 6 7 AHMED SAID Hadaïta None 1\n",
|
||
" 7 8 ALI MADI Anissa None 1\n",
|
||
" 8 9 ALI Raydel None 1\n",
|
||
" 9 10 ATTOUMANE ALI Fatima None 1\n",
|
||
" 10 11 BACHIROU Elzame None 1\n",
|
||
" 11 12 BINALI Zalida None 1\n",
|
||
" 12 13 BOINA Abdillah Mze Limassi None 1\n",
|
||
" 13 14 BOUDRA Zaankidine None 1\n",
|
||
" 14 15 BOURA Kayssoiria None 1\n",
|
||
" 15 16 HALADI Asna None 1\n",
|
||
" 16 17 HALIDI Soibrata None 1\n",
|
||
" 17 18 HAMEDALY Doulkifly None 1\n",
|
||
" 18 19 IBRAHIM Nassur None 1\n",
|
||
" 19 20 INOUSSA Anchoura None 1\n",
|
||
" 20 21 MOHAMED Nadia None 1\n",
|
||
" 21 22 MOUHOUDHOIRE Izak None 1\n",
|
||
" 22 23 MOUSSRI Bakari None 1\n",
|
||
" 23 24 SAÏD Fatoumia None 1\n",
|
||
" 24 25 SAKOTRA Claudiana None 1\n",
|
||
" 25 26 TOUFAIL Salahou None 1\n",
|
||
" 26 76 Ibrahim Chaharzade None 1,\n",
|
||
" 'tribe': id name grade\n",
|
||
" 0 1 302 3e}"
|
||
]
|
||
},
|
||
"execution_count": 180,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"datas = pull_datas(1, conn)\n",
|
||
"datas"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 181,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"'DS1 mise en jambe'"
|
||
]
|
||
},
|
||
"execution_count": 181,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"datas['evaluation'][\"name\"][0]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 182,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"q_df = datas[\"questions\"]\n",
|
||
"q_df = q_df.assign(\n",
|
||
" Nom = q_df[[\"name\", \"comment\"]].apply(lambda x: \" \".join(x), 1)\n",
|
||
")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 183,
|
||
"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>id</th>\n",
|
||
" <th>name</th>\n",
|
||
" <th>score_rate</th>\n",
|
||
" <th>is_leveled</th>\n",
|
||
" <th>exercise_id</th>\n",
|
||
" <th>competence</th>\n",
|
||
" <th>domain</th>\n",
|
||
" <th>comment</th>\n",
|
||
" <th>Nom</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>Cher</td>\n",
|
||
" <td>Grandeurs</td>\n",
|
||
" <td>Lecture du thermomètre</td>\n",
|
||
" <td>1 Lecture du thermomètre</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>2</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>Cal</td>\n",
|
||
" <td>Grandeurs</td>\n",
|
||
" <td>Suivre programme de calculs</td>\n",
|
||
" <td>2 Suivre programme de calculs</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>2.c</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>Cal</td>\n",
|
||
" <td>Grandeurs</td>\n",
|
||
" <td>Renverser un programme de calculs</td>\n",
|
||
" <td>2.c Renverser un programme de calculs</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>4</td>\n",
|
||
" <td></td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>Cher</td>\n",
|
||
" <td>4opérations</td>\n",
|
||
" <td>Lire le tableau et le graphique</td>\n",
|
||
" <td>Lire le tableau et le graphique</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>5</td>\n",
|
||
" <td></td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>Cher</td>\n",
|
||
" <td>4opérations</td>\n",
|
||
" <td>Décomposer le problème</td>\n",
|
||
" <td>Décomposer le problème</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" id name score_rate is_leveled exercise_id competence domain \\\n",
|
||
"0 1 1 0 1 1 Cher Grandeurs \n",
|
||
"1 2 2 0 1 1 Cal Grandeurs \n",
|
||
"2 3 2.c 0 1 1 Cal Grandeurs \n",
|
||
"0 4 0 1 2 Cher 4opérations \n",
|
||
"1 5 0 1 2 Cher 4opérations \n",
|
||
"\n",
|
||
" comment Nom \n",
|
||
"0 Lecture du thermomètre 1 Lecture du thermomètre \n",
|
||
"1 Suivre programme de calculs 2 Suivre programme de calculs \n",
|
||
"2 Renverser un programme de calculs 2.c Renverser un programme de calculs \n",
|
||
"0 Lire le tableau et le graphique Lire le tableau et le graphique \n",
|
||
"1 Décomposer le problème Décomposer le problème "
|
||
]
|
||
},
|
||
"execution_count": 183,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"q_df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 184,
|
||
"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>id</th>\n",
|
||
" <th>name</th>\n",
|
||
" <th>eval_id</th>\n",
|
||
" <th>date</th>\n",
|
||
" <th>comment</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1 - Prendre la température</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2017-09-05 00:00:00.000000</td>\n",
|
||
" <td></td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>2</td>\n",
|
||
" <td>2 - Maladroite!</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2017-09-05 00:00:00.000000</td>\n",
|
||
" <td></td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" id name eval_id date comment\n",
|
||
"0 1 1 - Prendre la température 1 2017-09-05 00:00:00.000000 \n",
|
||
"1 2 2 - Maladroite! 1 2017-09-05 00:00:00.000000 "
|
||
]
|
||
},
|
||
"execution_count": 184,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"datas[\"exercises\"]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 185,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ex_q = q_df.groupby(\"exercise_id\")\\\n",
|
||
" .agg({\"score_rate\": np.sum, \"competence\": lambda x: '-'.join(list(x))}) \\\n",
|
||
" .merge(datas[\"exercises\"], left_index=True, right_on='id')\n",
|
||
"ex_q = ex_q.assign(\n",
|
||
" Nom = ex_q[\"name\"].apply(lambda x: f\"Ex {x}\"),\n",
|
||
" exercise_id = ex_q[\"id\"]\n",
|
||
")\n",
|
||
"#ex_q"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 186,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"sel_fields = ['Nom', 'competence', 'score_rate', 'exercise_id']\n",
|
||
"xls_df = pd.concat([ex_q[sel_fields], q_df[sel_fields]]).sort_values(\"exercise_id\")\n",
|
||
"#xls_df"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 187,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"#writer = pd.ExcelWriter(\"./test.xlsx\", engine=\"xlsxwriter\")\n",
|
||
"#xls_df.to_excel(writer, index=False, sheet_name='DNB blanc 2')"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 188,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"#workbook = writer.book\n",
|
||
"#worksheet = writer.sheets['DNB blanc 2']"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 189,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"#first_line_format = workbook.add_format({\"align\": 'center', \"rotation\":90})\n",
|
||
"\n",
|
||
"#worksheet.set_column('A:D', 20)\n"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 190,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"#writer.save()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## From xlsx"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 27,
|
||
"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>competence</th>\n",
|
||
" <th>Barème</th>\n",
|
||
" <th>ABDALLAH ALLAOUI Taiassima</th>\n",
|
||
" <th>ADANI Ismou</th>\n",
|
||
" <th>AHAMADA Dhoulkamal</th>\n",
|
||
" <th>AHAMADI Asbahati</th>\n",
|
||
" <th>AHAMADI OUSSENI Ansufiddine</th>\n",
|
||
" <th>AHAMED Fayadhi</th>\n",
|
||
" <th>AHMED SAID Hadaita</th>\n",
|
||
" <th>ALI MADI Anissa</th>\n",
|
||
" <th>...</th>\n",
|
||
" <th>MOUSSRI Bakari</th>\n",
|
||
" <th>SAID Fatoumia</th>\n",
|
||
" <th>SAKOTRA Claudiana</th>\n",
|
||
" <th>TOUFAIL Salahou</th>\n",
|
||
" <th>moyenne</th>\n",
|
||
" <th>Min</th>\n",
|
||
" <th>Q1</th>\n",
|
||
" <th>ME</th>\n",
|
||
" <th>Q3</th>\n",
|
||
" <th>Max</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>DNB blanc 2 général</th>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>112</td>\n",
|
||
" <td>24</td>\n",
|
||
" <td>52.0</td>\n",
|
||
" <td>46.5</td>\n",
|
||
" <td>65</td>\n",
|
||
" <td>27.0</td>\n",
|
||
" <td>25.5</td>\n",
|
||
" <td>75</td>\n",
|
||
" <td>72</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>40</td>\n",
|
||
" <td>50</td>\n",
|
||
" <td>60</td>\n",
|
||
" <td>58.5</td>\n",
|
||
" <td>43.403846</td>\n",
|
||
" <td>21.0</td>\n",
|
||
" <td>27.125</td>\n",
|
||
" <td>41.25</td>\n",
|
||
" <td>56.875</td>\n",
|
||
" <td>75.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>Ex 1 - Programme de calculs</th>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>15</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>11.0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>10</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>7</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>4.019231</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.250</td>\n",
|
||
" <td>3.00</td>\n",
|
||
" <td>6.875</td>\n",
|
||
" <td>11.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1 et 2 Suivre le programme</th>\n",
|
||
" <td>Cal</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>2.692308</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.250</td>\n",
|
||
" <td>2.00</td>\n",
|
||
" <td>5.750</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3 Renverser le programme</th>\n",
|
||
" <td>Rai</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.596154</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.000</td>\n",
|
||
" <td>0.00</td>\n",
|
||
" <td>1.125</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4 Toujours la même chose</th>\n",
|
||
" <td>Rai</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.192308</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.000</td>\n",
|
||
" <td>0.00</td>\n",
|
||
" <td>0.000</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>5 rows × 35 columns</p>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" competence Barème ABDALLAH ALLAOUI Taiassima \\\n",
|
||
"DNB blanc 2 général NaN 112 24 \n",
|
||
"Ex 1 - Programme de calculs NaN 15 3 \n",
|
||
"1 et 2 Suivre le programme Cal 6 3 \n",
|
||
"3 Renverser le programme Rai 3 0 \n",
|
||
"4 Toujours la même chose Rai 3 0 \n",
|
||
"\n",
|
||
" ADANI Ismou AHAMADA Dhoulkamal \\\n",
|
||
"DNB blanc 2 général 52.0 46.5 \n",
|
||
"Ex 1 - Programme de calculs 11.0 3.0 \n",
|
||
"1 et 2 Suivre le programme 6.0 2.0 \n",
|
||
"3 Renverser le programme 3.0 0.0 \n",
|
||
"4 Toujours la même chose 2.0 0.0 \n",
|
||
"\n",
|
||
" AHAMADI Asbahati AHAMADI OUSSENI Ansufiddine \\\n",
|
||
"DNB blanc 2 général 65 27.0 \n",
|
||
"Ex 1 - Programme de calculs 0 1.0 \n",
|
||
"1 et 2 Suivre le programme 0 0.0 \n",
|
||
"3 Renverser le programme 0 0.0 \n",
|
||
"4 Toujours la même chose 0 0.0 \n",
|
||
"\n",
|
||
" AHAMED Fayadhi AHMED SAID Hadaita \\\n",
|
||
"DNB blanc 2 général 25.5 75 \n",
|
||
"Ex 1 - Programme de calculs 0.0 3 \n",
|
||
"1 et 2 Suivre le programme 0.0 2 \n",
|
||
"3 Renverser le programme 0.0 0 \n",
|
||
"4 Toujours la même chose 0.0 0 \n",
|
||
"\n",
|
||
" ALI MADI Anissa ... MOUSSRI Bakari \\\n",
|
||
"DNB blanc 2 général 72 ... 40 \n",
|
||
"Ex 1 - Programme de calculs 10 ... 2 \n",
|
||
"1 et 2 Suivre le programme 6 ... 0 \n",
|
||
"3 Renverser le programme 0 ... 0 \n",
|
||
"4 Toujours la même chose 3 ... 0 \n",
|
||
"\n",
|
||
" SAID Fatoumia SAKOTRA Claudiana \\\n",
|
||
"DNB blanc 2 général 50 60 \n",
|
||
"Ex 1 - Programme de calculs 0 7 \n",
|
||
"1 et 2 Suivre le programme 0 2 \n",
|
||
"3 Renverser le programme 0 2 \n",
|
||
"4 Toujours la même chose 0 0 \n",
|
||
"\n",
|
||
" TOUFAIL Salahou moyenne Min Q1 ME \\\n",
|
||
"DNB blanc 2 général 58.5 43.403846 21.0 27.125 41.25 \n",
|
||
"Ex 1 - Programme de calculs 2.0 4.019231 0.0 1.250 3.00 \n",
|
||
"1 et 2 Suivre le programme 1.0 2.692308 0.0 0.250 2.00 \n",
|
||
"3 Renverser le programme 0.0 0.596154 0.0 0.000 0.00 \n",
|
||
"4 Toujours la même chose 0.0 0.192308 0.0 0.000 0.00 \n",
|
||
"\n",
|
||
" Q3 Max \n",
|
||
"DNB blanc 2 général 56.875 75.0 \n",
|
||
"Ex 1 - Programme de calculs 6.875 11.0 \n",
|
||
"1 et 2 Suivre le programme 5.750 6.0 \n",
|
||
"3 Renverser le programme 1.125 3.0 \n",
|
||
"4 Toujours la même chose 0.000 3.0 \n",
|
||
"\n",
|
||
"[5 rows x 35 columns]"
|
||
]
|
||
},
|
||
"execution_count": 27,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = pd.read_excel(\"./DNB_blanc2/DNB2_302.xlsx\")\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"On enlève les colonnes inutiles et on format les prénoms"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 28,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"import unicodedata\n",
|
||
"def normalize_str(s):\n",
|
||
" return unicodedata.normalize('NFD', s).encode('ascii', 'ignore').lower()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 29,
|
||
"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>b'abdallah allaoui taiassima'</th>\n",
|
||
" <th>b'adani ismou'</th>\n",
|
||
" <th>b'ahamada dhoulkamal'</th>\n",
|
||
" <th>b'ahamadi asbahati'</th>\n",
|
||
" <th>b'ahamadi ousseni ansufiddine'</th>\n",
|
||
" <th>b'ahamed fayadhi'</th>\n",
|
||
" <th>b'ahmed said hadaita'</th>\n",
|
||
" <th>b'ali madi anissa'</th>\n",
|
||
" <th>b'ali raydel'</th>\n",
|
||
" <th>b'attoumane ali fatima'</th>\n",
|
||
" <th>...</th>\n",
|
||
" <th>b'hamedaly doulkifly'</th>\n",
|
||
" <th>b'ibrahim chaharzade'</th>\n",
|
||
" <th>b'ibrahim nassur'</th>\n",
|
||
" <th>b'inoussa anchoura'</th>\n",
|
||
" <th>b'mohamed nadia'</th>\n",
|
||
" <th>b'mouhoudhoire izak'</th>\n",
|
||
" <th>b'moussri bakari'</th>\n",
|
||
" <th>b'said fatoumia'</th>\n",
|
||
" <th>b'sakotra claudiana'</th>\n",
|
||
" <th>b'toufail salahou'</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>DNB blanc 2 général</th>\n",
|
||
" <td>24</td>\n",
|
||
" <td>52.0</td>\n",
|
||
" <td>46.5</td>\n",
|
||
" <td>65</td>\n",
|
||
" <td>27.0</td>\n",
|
||
" <td>25.5</td>\n",
|
||
" <td>75</td>\n",
|
||
" <td>72</td>\n",
|
||
" <td>45.5</td>\n",
|
||
" <td>26.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>23.5</td>\n",
|
||
" <td>49.0</td>\n",
|
||
" <td>42.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>27.5</td>\n",
|
||
" <td>37</td>\n",
|
||
" <td>40</td>\n",
|
||
" <td>50</td>\n",
|
||
" <td>60</td>\n",
|
||
" <td>58.5</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>Ex 1 - Programme de calculs</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>11.0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>10</td>\n",
|
||
" <td>9.0</td>\n",
|
||
" <td>6.5</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>4.5</td>\n",
|
||
" <td>7.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>2.5</td>\n",
|
||
" <td>5</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>7</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1 et 2 Suivre le programme</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>5.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3 Renverser le programme</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4 Toujours la même chose</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>5 rows × 27 columns</p>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" b'abdallah allaoui taiassima' b'adani ismou' \\\n",
|
||
"DNB blanc 2 général 24 52.0 \n",
|
||
"Ex 1 - Programme de calculs 3 11.0 \n",
|
||
"1 et 2 Suivre le programme 3 6.0 \n",
|
||
"3 Renverser le programme 0 3.0 \n",
|
||
"4 Toujours la même chose 0 2.0 \n",
|
||
"\n",
|
||
" b'ahamada dhoulkamal' b'ahamadi asbahati' \\\n",
|
||
"DNB blanc 2 général 46.5 65 \n",
|
||
"Ex 1 - Programme de calculs 3.0 0 \n",
|
||
"1 et 2 Suivre le programme 2.0 0 \n",
|
||
"3 Renverser le programme 0.0 0 \n",
|
||
"4 Toujours la même chose 0.0 0 \n",
|
||
"\n",
|
||
" b'ahamadi ousseni ansufiddine' \\\n",
|
||
"DNB blanc 2 général 27.0 \n",
|
||
"Ex 1 - Programme de calculs 1.0 \n",
|
||
"1 et 2 Suivre le programme 0.0 \n",
|
||
"3 Renverser le programme 0.0 \n",
|
||
"4 Toujours la même chose 0.0 \n",
|
||
"\n",
|
||
" b'ahamed fayadhi' b'ahmed said hadaita' \\\n",
|
||
"DNB blanc 2 général 25.5 75 \n",
|
||
"Ex 1 - Programme de calculs 0.0 3 \n",
|
||
"1 et 2 Suivre le programme 0.0 2 \n",
|
||
"3 Renverser le programme 0.0 0 \n",
|
||
"4 Toujours la même chose 0.0 0 \n",
|
||
"\n",
|
||
" b'ali madi anissa' b'ali raydel' \\\n",
|
||
"DNB blanc 2 général 72 45.5 \n",
|
||
"Ex 1 - Programme de calculs 10 9.0 \n",
|
||
"1 et 2 Suivre le programme 6 6.0 \n",
|
||
"3 Renverser le programme 0 3.0 \n",
|
||
"4 Toujours la même chose 3 0.0 \n",
|
||
"\n",
|
||
" b'attoumane ali fatima' ... \\\n",
|
||
"DNB blanc 2 général 26.0 ... \n",
|
||
"Ex 1 - Programme de calculs 6.5 ... \n",
|
||
"1 et 2 Suivre le programme 5.0 ... \n",
|
||
"3 Renverser le programme 1.5 ... \n",
|
||
"4 Toujours la même chose 0.0 ... \n",
|
||
"\n",
|
||
" b'hamedaly doulkifly' b'ibrahim chaharzade' \\\n",
|
||
"DNB blanc 2 général 23.5 49.0 \n",
|
||
"Ex 1 - Programme de calculs 2.0 4.5 \n",
|
||
"1 et 2 Suivre le programme 2.0 3.0 \n",
|
||
"3 Renverser le programme 0.0 0.0 \n",
|
||
"4 Toujours la même chose 0.0 0.0 \n",
|
||
"\n",
|
||
" b'ibrahim nassur' b'inoussa anchoura' \\\n",
|
||
"DNB blanc 2 général 42.5 NaN \n",
|
||
"Ex 1 - Programme de calculs 7.5 NaN \n",
|
||
"1 et 2 Suivre le programme 6.0 NaN \n",
|
||
"3 Renverser le programme 1.5 NaN \n",
|
||
"4 Toujours la même chose 0.0 NaN \n",
|
||
"\n",
|
||
" b'mohamed nadia' b'mouhoudhoire izak' \\\n",
|
||
"DNB blanc 2 général 27.5 37 \n",
|
||
"Ex 1 - Programme de calculs 2.5 5 \n",
|
||
"1 et 2 Suivre le programme 1.0 4 \n",
|
||
"3 Renverser le programme 0.0 0 \n",
|
||
"4 Toujours la même chose 0.0 0 \n",
|
||
"\n",
|
||
" b'moussri bakari' b'said fatoumia' \\\n",
|
||
"DNB blanc 2 général 40 50 \n",
|
||
"Ex 1 - Programme de calculs 2 0 \n",
|
||
"1 et 2 Suivre le programme 0 0 \n",
|
||
"3 Renverser le programme 0 0 \n",
|
||
"4 Toujours la même chose 0 0 \n",
|
||
"\n",
|
||
" b'sakotra claudiana' b'toufail salahou' \n",
|
||
"DNB blanc 2 général 60 58.5 \n",
|
||
"Ex 1 - Programme de calculs 7 2.0 \n",
|
||
"1 et 2 Suivre le programme 2 1.0 \n",
|
||
"3 Renverser le programme 2 0.0 \n",
|
||
"4 Toujours la même chose 0 0.0 \n",
|
||
"\n",
|
||
"[5 rows x 27 columns]"
|
||
]
|
||
},
|
||
"execution_count": 29,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = df.drop(['competence', 'Barème','moyenne',\n",
|
||
" 'Min', 'Q1', 'ME', 'Q3', 'Max'], 1)\n",
|
||
"df.columns = [normalize_str(i) for i in df.columns]\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 30,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"DNB blanc 2 général 52.0\n",
|
||
"Ex 1 - Programme de calculs 11.0\n",
|
||
"1 et 2 Suivre le programme 6.0\n",
|
||
"3 Renverser le programme 3.0\n",
|
||
"4 Toujours la même chose 2.0\n",
|
||
"4 Développer F 0.0\n",
|
||
"Ex 2 - Choix de piste 4.0\n",
|
||
"1 Fraction réponse 4.0\n",
|
||
"1 Notation et vocabulaire 0.0\n",
|
||
"2 Arbre de probabilité 0.0\n",
|
||
"Ex 3 - Réduction sur les cahiers 4.0\n",
|
||
"1 et 2 Raisonnement pour choisir 1.0\n",
|
||
"1 et 2 Décomposer le problème 2.0\n",
|
||
"1 et 2 Choix des opérations et calculs 1.0\n",
|
||
"3 Composition des réductions 0.0\n",
|
||
"Ex 4 - Athlétisme 9.0\n",
|
||
"1 Logique de la réponse 3.0\n",
|
||
"1 Calculs des indicateurs 2.0\n",
|
||
"1 Clarté des explications 1.0\n",
|
||
"2 Calculs 1.5\n",
|
||
"2 Validité des réponses 1.5\n",
|
||
"2 Tests des possibilités 0.0\n",
|
||
"Ex 5 - Géométrie 14.0\n",
|
||
" Reconnaitre les théorèmes 5.0\n",
|
||
" Validité des calculs 5.0\n",
|
||
" Suivi du raisonnement géométrique 4.0\n",
|
||
"Ex 6 - Confitures 0.0\n",
|
||
"1 Quantité de sucre 0.0\n",
|
||
"2 Calcul du volume 0.0\n",
|
||
"2 Nombre de pots 0.0\n",
|
||
"3 Dessin de l'étiquette 0.0\n",
|
||
"3 Mise à l'echelle 0.0\n",
|
||
"3 Longueur de l'étiquette 0.0\n",
|
||
"Ex Présentation 10.0\n",
|
||
" Présentation 10.0\n",
|
||
"Name: b'adani ismou', dtype: float64"
|
||
]
|
||
},
|
||
"execution_count": 30,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df[b\"adani ismou\"]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"On enlèves les lignes calculées par excel pour ne garder que les données"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 31,
|
||
"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>b'abdallah allaoui taiassima'</th>\n",
|
||
" <th>b'adani ismou'</th>\n",
|
||
" <th>b'ahamada dhoulkamal'</th>\n",
|
||
" <th>b'ahamadi asbahati'</th>\n",
|
||
" <th>b'ahamadi ousseni ansufiddine'</th>\n",
|
||
" <th>b'ahamed fayadhi'</th>\n",
|
||
" <th>b'ahmed said hadaita'</th>\n",
|
||
" <th>b'ali madi anissa'</th>\n",
|
||
" <th>b'ali raydel'</th>\n",
|
||
" <th>b'attoumane ali fatima'</th>\n",
|
||
" <th>...</th>\n",
|
||
" <th>b'hamedaly doulkifly'</th>\n",
|
||
" <th>b'ibrahim chaharzade'</th>\n",
|
||
" <th>b'ibrahim nassur'</th>\n",
|
||
" <th>b'inoussa anchoura'</th>\n",
|
||
" <th>b'mohamed nadia'</th>\n",
|
||
" <th>b'mouhoudhoire izak'</th>\n",
|
||
" <th>b'moussri bakari'</th>\n",
|
||
" <th>b'said fatoumia'</th>\n",
|
||
" <th>b'sakotra claudiana'</th>\n",
|
||
" <th>b'toufail salahou'</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>1 et 2 Suivre le programme</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>5.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3 Renverser le programme</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4 Toujours la même chose</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4 Développer F</th>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1 Fraction réponse</th>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>5 rows × 27 columns</p>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" b'abdallah allaoui taiassima' b'adani ismou' \\\n",
|
||
"1 et 2 Suivre le programme 3 6.0 \n",
|
||
"3 Renverser le programme 0 3.0 \n",
|
||
"4 Toujours la même chose 0 2.0 \n",
|
||
"4 Développer F 0 0.0 \n",
|
||
"1 Fraction réponse 4 4.0 \n",
|
||
"\n",
|
||
" b'ahamada dhoulkamal' b'ahamadi asbahati' \\\n",
|
||
"1 et 2 Suivre le programme 2.0 0 \n",
|
||
"3 Renverser le programme 0.0 0 \n",
|
||
"4 Toujours la même chose 0.0 0 \n",
|
||
"4 Développer F 1.0 0 \n",
|
||
"1 Fraction réponse 4.0 4 \n",
|
||
"\n",
|
||
" b'ahamadi ousseni ansufiddine' b'ahamed fayadhi' \\\n",
|
||
"1 et 2 Suivre le programme 0.0 0.0 \n",
|
||
"3 Renverser le programme 0.0 0.0 \n",
|
||
"4 Toujours la même chose 0.0 0.0 \n",
|
||
"4 Développer F 1.0 0.0 \n",
|
||
"1 Fraction réponse 3.0 4.0 \n",
|
||
"\n",
|
||
" b'ahmed said hadaita' b'ali madi anissa' \\\n",
|
||
"1 et 2 Suivre le programme 2 6 \n",
|
||
"3 Renverser le programme 0 0 \n",
|
||
"4 Toujours la même chose 0 3 \n",
|
||
"4 Développer F 1 1 \n",
|
||
"1 Fraction réponse 4 4 \n",
|
||
"\n",
|
||
" b'ali raydel' b'attoumane ali fatima' \\\n",
|
||
"1 et 2 Suivre le programme 6.0 5.0 \n",
|
||
"3 Renverser le programme 3.0 1.5 \n",
|
||
"4 Toujours la même chose 0.0 0.0 \n",
|
||
"4 Développer F 0.0 0.0 \n",
|
||
"1 Fraction réponse 4.0 4.0 \n",
|
||
"\n",
|
||
" ... b'hamedaly doulkifly' \\\n",
|
||
"1 et 2 Suivre le programme ... 2.0 \n",
|
||
"3 Renverser le programme ... 0.0 \n",
|
||
"4 Toujours la même chose ... 0.0 \n",
|
||
"4 Développer F ... 0.0 \n",
|
||
"1 Fraction réponse ... 3.0 \n",
|
||
"\n",
|
||
" b'ibrahim chaharzade' b'ibrahim nassur' \\\n",
|
||
"1 et 2 Suivre le programme 3.0 6.0 \n",
|
||
"3 Renverser le programme 0.0 1.5 \n",
|
||
"4 Toujours la même chose 0.0 0.0 \n",
|
||
"4 Développer F 1.5 0.0 \n",
|
||
"1 Fraction réponse 4.0 4.0 \n",
|
||
"\n",
|
||
" b'inoussa anchoura' b'mohamed nadia' \\\n",
|
||
"1 et 2 Suivre le programme NaN 1.0 \n",
|
||
"3 Renverser le programme NaN 0.0 \n",
|
||
"4 Toujours la même chose NaN 0.0 \n",
|
||
"4 Développer F NaN 1.5 \n",
|
||
"1 Fraction réponse NaN 4.0 \n",
|
||
"\n",
|
||
" b'mouhoudhoire izak' b'moussri bakari' \\\n",
|
||
"1 et 2 Suivre le programme 4 0 \n",
|
||
"3 Renverser le programme 0 0 \n",
|
||
"4 Toujours la même chose 0 0 \n",
|
||
"4 Développer F 1 2 \n",
|
||
"1 Fraction réponse 4 4 \n",
|
||
"\n",
|
||
" b'said fatoumia' b'sakotra claudiana' \\\n",
|
||
"1 et 2 Suivre le programme 0 2 \n",
|
||
"3 Renverser le programme 0 2 \n",
|
||
"4 Toujours la même chose 0 0 \n",
|
||
"4 Développer F 0 3 \n",
|
||
"1 Fraction réponse 4 4 \n",
|
||
"\n",
|
||
" b'toufail salahou' \n",
|
||
"1 et 2 Suivre le programme 1.0 \n",
|
||
"3 Renverser le programme 0.0 \n",
|
||
"4 Toujours la même chose 0.0 \n",
|
||
"4 Développer F 1.0 \n",
|
||
"1 Fraction réponse 4.0 \n",
|
||
"\n",
|
||
"[5 rows x 27 columns]"
|
||
]
|
||
},
|
||
"execution_count": 31,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = df[list(~df.reset_index()[\"index\"].apply(lambda x: x.startswith(\"Ex\") or x.startswith(\"DNB\")))]\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 32,
|
||
"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>index</th>\n",
|
||
" <th>b'abdallah allaoui taiassima'</th>\n",
|
||
" <th>b'adani ismou'</th>\n",
|
||
" <th>b'ahamada dhoulkamal'</th>\n",
|
||
" <th>b'ahamadi asbahati'</th>\n",
|
||
" <th>b'ahamadi ousseni ansufiddine'</th>\n",
|
||
" <th>b'ahamed fayadhi'</th>\n",
|
||
" <th>b'ahmed said hadaita'</th>\n",
|
||
" <th>b'ali madi anissa'</th>\n",
|
||
" <th>b'ali raydel'</th>\n",
|
||
" <th>...</th>\n",
|
||
" <th>b'hamedaly doulkifly'</th>\n",
|
||
" <th>b'ibrahim chaharzade'</th>\n",
|
||
" <th>b'ibrahim nassur'</th>\n",
|
||
" <th>b'inoussa anchoura'</th>\n",
|
||
" <th>b'mohamed nadia'</th>\n",
|
||
" <th>b'mouhoudhoire izak'</th>\n",
|
||
" <th>b'moussri bakari'</th>\n",
|
||
" <th>b'said fatoumia'</th>\n",
|
||
" <th>b'sakotra claudiana'</th>\n",
|
||
" <th>b'toufail salahou'</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>3 Renverser le programme</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>4 Toujours la même chose</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>4 Développer F</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>1 Fraction réponse</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>5 rows × 28 columns</p>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" index b'abdallah allaoui taiassima' b'adani ismou' \\\n",
|
||
"0 1 et 2 Suivre le programme 3 6.0 \n",
|
||
"1 3 Renverser le programme 0 3.0 \n",
|
||
"2 4 Toujours la même chose 0 2.0 \n",
|
||
"3 4 Développer F 0 0.0 \n",
|
||
"4 1 Fraction réponse 4 4.0 \n",
|
||
"\n",
|
||
" b'ahamada dhoulkamal' b'ahamadi asbahati' b'ahamadi ousseni ansufiddine' \\\n",
|
||
"0 2.0 0 0.0 \n",
|
||
"1 0.0 0 0.0 \n",
|
||
"2 0.0 0 0.0 \n",
|
||
"3 1.0 0 1.0 \n",
|
||
"4 4.0 4 3.0 \n",
|
||
"\n",
|
||
" b'ahamed fayadhi' b'ahmed said hadaita' b'ali madi anissa' \\\n",
|
||
"0 0.0 2 6 \n",
|
||
"1 0.0 0 0 \n",
|
||
"2 0.0 0 3 \n",
|
||
"3 0.0 1 1 \n",
|
||
"4 4.0 4 4 \n",
|
||
"\n",
|
||
" b'ali raydel' ... b'hamedaly doulkifly' \\\n",
|
||
"0 6.0 ... 2.0 \n",
|
||
"1 3.0 ... 0.0 \n",
|
||
"2 0.0 ... 0.0 \n",
|
||
"3 0.0 ... 0.0 \n",
|
||
"4 4.0 ... 3.0 \n",
|
||
"\n",
|
||
" b'ibrahim chaharzade' b'ibrahim nassur' b'inoussa anchoura' \\\n",
|
||
"0 3.0 6.0 NaN \n",
|
||
"1 0.0 1.5 NaN \n",
|
||
"2 0.0 0.0 NaN \n",
|
||
"3 1.5 0.0 NaN \n",
|
||
"4 4.0 4.0 NaN \n",
|
||
"\n",
|
||
" b'mohamed nadia' b'mouhoudhoire izak' b'moussri bakari' \\\n",
|
||
"0 1.0 4 0 \n",
|
||
"1 0.0 0 0 \n",
|
||
"2 0.0 0 0 \n",
|
||
"3 1.5 1 2 \n",
|
||
"4 4.0 4 4 \n",
|
||
"\n",
|
||
" b'said fatoumia' b'sakotra claudiana' b'toufail salahou' \n",
|
||
"0 0 2 1.0 \n",
|
||
"1 0 2 0.0 \n",
|
||
"2 0 0 0.0 \n",
|
||
"3 0 3 1.0 \n",
|
||
"4 4 4 4.0 \n",
|
||
"\n",
|
||
"[5 rows x 28 columns]"
|
||
]
|
||
},
|
||
"execution_count": 32,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = df.reset_index()\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"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>index</th>\n",
|
||
" <th>b'abdallah allaoui taiassima'</th>\n",
|
||
" <th>b'adani ismou'</th>\n",
|
||
" <th>b'ahamada dhoulkamal'</th>\n",
|
||
" <th>b'ahamadi asbahati'</th>\n",
|
||
" <th>b'ahamadi ousseni ansufiddine'</th>\n",
|
||
" <th>b'ahamed fayadhi'</th>\n",
|
||
" <th>b'ahmed said hadaita'</th>\n",
|
||
" <th>b'ali madi anissa'</th>\n",
|
||
" <th>b'ali raydel'</th>\n",
|
||
" <th>...</th>\n",
|
||
" <th>b'ibrahim chaharzade'</th>\n",
|
||
" <th>b'ibrahim nassur'</th>\n",
|
||
" <th>b'inoussa anchoura'</th>\n",
|
||
" <th>b'mohamed nadia'</th>\n",
|
||
" <th>b'mouhoudhoire izak'</th>\n",
|
||
" <th>b'moussri bakari'</th>\n",
|
||
" <th>b'said fatoumia'</th>\n",
|
||
" <th>b'sakotra claudiana'</th>\n",
|
||
" <th>b'toufail salahou'</th>\n",
|
||
" <th>q_name</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>3 Renverser le programme</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>b'3 renverser le programme'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>4 Toujours la même chose</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>b'4 toujours la meme chose'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>4 Développer F</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>1.5</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>2</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>1.0</td>\n",
|
||
" <td>b'4 developper f'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>1 Fraction réponse</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>...</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>NaN</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" <td>b'1 fraction reponse'</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"<p>5 rows × 29 columns</p>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" index b'abdallah allaoui taiassima' b'adani ismou' \\\n",
|
||
"0 1 et 2 Suivre le programme 3 6.0 \n",
|
||
"1 3 Renverser le programme 0 3.0 \n",
|
||
"2 4 Toujours la même chose 0 2.0 \n",
|
||
"3 4 Développer F 0 0.0 \n",
|
||
"4 1 Fraction réponse 4 4.0 \n",
|
||
"\n",
|
||
" b'ahamada dhoulkamal' b'ahamadi asbahati' b'ahamadi ousseni ansufiddine' \\\n",
|
||
"0 2.0 0 0.0 \n",
|
||
"1 0.0 0 0.0 \n",
|
||
"2 0.0 0 0.0 \n",
|
||
"3 1.0 0 1.0 \n",
|
||
"4 4.0 4 3.0 \n",
|
||
"\n",
|
||
" b'ahamed fayadhi' b'ahmed said hadaita' b'ali madi anissa' \\\n",
|
||
"0 0.0 2 6 \n",
|
||
"1 0.0 0 0 \n",
|
||
"2 0.0 0 3 \n",
|
||
"3 0.0 1 1 \n",
|
||
"4 4.0 4 4 \n",
|
||
"\n",
|
||
" b'ali raydel' ... b'ibrahim chaharzade' \\\n",
|
||
"0 6.0 ... 3.0 \n",
|
||
"1 3.0 ... 0.0 \n",
|
||
"2 0.0 ... 0.0 \n",
|
||
"3 0.0 ... 1.5 \n",
|
||
"4 4.0 ... 4.0 \n",
|
||
"\n",
|
||
" b'ibrahim nassur' b'inoussa anchoura' b'mohamed nadia' \\\n",
|
||
"0 6.0 NaN 1.0 \n",
|
||
"1 1.5 NaN 0.0 \n",
|
||
"2 0.0 NaN 0.0 \n",
|
||
"3 0.0 NaN 1.5 \n",
|
||
"4 4.0 NaN 4.0 \n",
|
||
"\n",
|
||
" b'mouhoudhoire izak' b'moussri bakari' b'said fatoumia' \\\n",
|
||
"0 4 0 0 \n",
|
||
"1 0 0 0 \n",
|
||
"2 0 0 0 \n",
|
||
"3 1 2 0 \n",
|
||
"4 4 4 4 \n",
|
||
"\n",
|
||
" b'sakotra claudiana' b'toufail salahou' q_name \n",
|
||
"0 2 1.0 b'1 et 2 suivre le programme' \n",
|
||
"1 2 0.0 b'3 renverser le programme' \n",
|
||
"2 0 0.0 b'4 toujours la meme chose' \n",
|
||
"3 3 1.0 b'4 developper f' \n",
|
||
"4 4 4.0 b'1 fraction reponse' \n",
|
||
"\n",
|
||
"[5 rows x 29 columns]"
|
||
]
|
||
},
|
||
"execution_count": 33,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = df.assign(\n",
|
||
" q_name = df[\"index\"].apply(normalize_str),\n",
|
||
" )\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 34,
|
||
"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>index</th>\n",
|
||
" <th>q_name</th>\n",
|
||
" <th>level_2</th>\n",
|
||
" <th>0</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>b'abdallah allaoui taiassima'</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>b'adani ismou'</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>b'ahamada dhoulkamal'</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>b'ahamadi asbahati'</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>1 et 2 Suivre le programme</td>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>b'ahamadi ousseni ansufiddine'</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" index q_name \\\n",
|
||
"0 1 et 2 Suivre le programme b'1 et 2 suivre le programme' \n",
|
||
"1 1 et 2 Suivre le programme b'1 et 2 suivre le programme' \n",
|
||
"2 1 et 2 Suivre le programme b'1 et 2 suivre le programme' \n",
|
||
"3 1 et 2 Suivre le programme b'1 et 2 suivre le programme' \n",
|
||
"4 1 et 2 Suivre le programme b'1 et 2 suivre le programme' \n",
|
||
"\n",
|
||
" level_2 0 \n",
|
||
"0 b'abdallah allaoui taiassima' 3.0 \n",
|
||
"1 b'adani ismou' 6.0 \n",
|
||
"2 b'ahamada dhoulkamal' 2.0 \n",
|
||
"3 b'ahamadi asbahati' 0.0 \n",
|
||
"4 b'ahamadi ousseni ansufiddine' 0.0 "
|
||
]
|
||
},
|
||
"execution_count": 34,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df = df.set_index([\"index\", \"q_name\"]).stack().reset_index()\n",
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 35,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"df = df.rename(columns={0:\"value\", \"level_2\": \"norm_surname\"})"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Il ne reste plus qu'à trouver les correspondances avec la base de données."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 36,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"sqlite_datas = pull_sqlite(34, conn)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Les élèves"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 37,
|
||
"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>id</th>\n",
|
||
" <th>name</th>\n",
|
||
" <th>surname</th>\n",
|
||
" <th>mail</th>\n",
|
||
" <th>commment</th>\n",
|
||
" <th>tribe_id</th>\n",
|
||
" <th>norm_surname</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1</td>\n",
|
||
" <td>ABDALLAH ALLAOUI</td>\n",
|
||
" <td>Taiassima</td>\n",
|
||
" <td></td>\n",
|
||
" <td>None</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>b'abdallah allaoui taiassima'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>2</td>\n",
|
||
" <td>ADANI</td>\n",
|
||
" <td>Ismou</td>\n",
|
||
" <td></td>\n",
|
||
" <td>None</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>b'adani ismou'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>AHAMADA</td>\n",
|
||
" <td>Dhoulkamal</td>\n",
|
||
" <td></td>\n",
|
||
" <td>None</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>b'ahamada dhoulkamal'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>4</td>\n",
|
||
" <td>AHAMADI</td>\n",
|
||
" <td>Asbahati</td>\n",
|
||
" <td></td>\n",
|
||
" <td>None</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>b'ahamadi asbahati'</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>5</td>\n",
|
||
" <td>AHAMADI OUSSENI</td>\n",
|
||
" <td>Ansufiddine</td>\n",
|
||
" <td></td>\n",
|
||
" <td>None</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>b'ahamadi ousseni ansufiddine'</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" id name surname mail commment tribe_id \\\n",
|
||
"0 1 ABDALLAH ALLAOUI Taiassima None 1 \n",
|
||
"1 2 ADANI Ismou None 1 \n",
|
||
"2 3 AHAMADA Dhoulkamal None 1 \n",
|
||
"3 4 AHAMADI Asbahati None 1 \n",
|
||
"4 5 AHAMADI OUSSENI Ansufiddine None 1 \n",
|
||
"\n",
|
||
" norm_surname \n",
|
||
"0 b'abdallah allaoui taiassima' \n",
|
||
"1 b'adani ismou' \n",
|
||
"2 b'ahamada dhoulkamal' \n",
|
||
"3 b'ahamadi asbahati' \n",
|
||
"4 b'ahamadi ousseni ansufiddine' "
|
||
]
|
||
},
|
||
"execution_count": 37,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"def tmp(x):\n",
|
||
" return normalize_str(\" \".join([x[\"name\"], x['surname']]))\n",
|
||
"st_df = sqlite_datas[\"students\"]\n",
|
||
"st_df = st_df.assign(\n",
|
||
" norm_surname = st_df[[\"surname\", \"name\"]].apply(tmp,1)\n",
|
||
")\n",
|
||
"st_df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 38,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"set()"
|
||
]
|
||
},
|
||
"execution_count": 38,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"set(df['norm_surname'].unique()).difference(set(st_df['norm_surname'].unique()))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 39,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"{b'inoussa anchoura'}"
|
||
]
|
||
},
|
||
"execution_count": 39,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"set(st_df['norm_surname'].unique()).difference(set(df['norm_surname'].unique()))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 40,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"df = pd.merge(df, st_df, left_on='norm_surname', right_on=\"norm_surname\")[[\"q_name\", \"id\", \"value\"]]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 41,
|
||
"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>q_name</th>\n",
|
||
" <th>id</th>\n",
|
||
" <th>value</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>b'1 et 2 suivre le programme'</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>b'3 renverser le programme'</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>b'4 toujours la meme chose'</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>b'4 developper f'</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>b'1 fraction reponse'</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>4.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" q_name id value\n",
|
||
"0 b'1 et 2 suivre le programme' 1 3.0\n",
|
||
"1 b'3 renverser le programme' 1 0.0\n",
|
||
"2 b'4 toujours la meme chose' 1 0.0\n",
|
||
"3 b'4 developper f' 1 0.0\n",
|
||
"4 b'1 fraction reponse' 1 4.0"
|
||
]
|
||
},
|
||
"execution_count": 41,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Les questions"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 42,
|
||
"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>id</th>\n",
|
||
" <th>name</th>\n",
|
||
" <th>score_rate</th>\n",
|
||
" <th>is_leveled</th>\n",
|
||
" <th>exercise_id</th>\n",
|
||
" <th>competence</th>\n",
|
||
" <th>domain</th>\n",
|
||
" <th>comment</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>400</td>\n",
|
||
" <td>1 et 2</td>\n",
|
||
" <td>6</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>122</td>\n",
|
||
" <td>Cal</td>\n",
|
||
" <td>Programme de calculs</td>\n",
|
||
" <td>Suivre le programme</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>401</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>122</td>\n",
|
||
" <td>Rai</td>\n",
|
||
" <td>Programme de calculs</td>\n",
|
||
" <td>Renverser le programme</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>402</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>122</td>\n",
|
||
" <td>Rai</td>\n",
|
||
" <td>Programme de calculs</td>\n",
|
||
" <td>Toujours la même chose</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>403</td>\n",
|
||
" <td>4</td>\n",
|
||
" <td>3</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>122</td>\n",
|
||
" <td>Cal</td>\n",
|
||
" <td>Programme de calculs</td>\n",
|
||
" <td>Développer F</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>404</td>\n",
|
||
" <td>1</td>\n",
|
||
" <td>8</td>\n",
|
||
" <td>0</td>\n",
|
||
" <td>123</td>\n",
|
||
" <td>Com</td>\n",
|
||
" <td>Probablilité</td>\n",
|
||
" <td>Notation et vocabulaire</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" id name score_rate is_leveled exercise_id competence \\\n",
|
||
"0 400 1 et 2 6 0 122 Cal \n",
|
||
"1 401 3 3 0 122 Rai \n",
|
||
"2 402 4 3 0 122 Rai \n",
|
||
"3 403 4 3 0 122 Cal \n",
|
||
"0 404 1 8 0 123 Com \n",
|
||
"\n",
|
||
" domain comment \n",
|
||
"0 Programme de calculs Suivre le programme \n",
|
||
"1 Programme de calculs Renverser le programme \n",
|
||
"2 Programme de calculs Toujours la même chose \n",
|
||
"3 Programme de calculs Développer F \n",
|
||
"0 Probablilité Notation et vocabulaire "
|
||
]
|
||
},
|
||
"execution_count": 42,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"q_df = sqlite_datas[\"questions\"]\n",
|
||
"q_df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 43,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"def tmp(x):\n",
|
||
" return normalize_str(\" \".join([x[\"name\"], x['comment']]))\n",
|
||
"q_df = q_df.assign(\n",
|
||
" q_name = q_df.apply(tmp, 1)\n",
|
||
")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 44,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"set()"
|
||
]
|
||
},
|
||
"execution_count": 44,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"set(q_df[\"q_name\"].unique()).difference(set(df[\"q_name\"].unique()))"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 45,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"array([b'1 et 2 suivre le programme', b'3 renverser le programme',\n",
|
||
" b'4 toujours la meme chose', b'4 developper f',\n",
|
||
" b'1 fraction reponse', b'1 notation et vocabulaire',\n",
|
||
" b'2 arbre de probabilite', b'1 et 2 raisonnement pour choisir',\n",
|
||
" b'1 et 2 decomposer le probleme',\n",
|
||
" b'1 et 2 choix des operations et calculs',\n",
|
||
" b'3 composition des reductions', b'1 logique de la reponse',\n",
|
||
" b'1 calculs des indicateurs', b'1 clarte des explications',\n",
|
||
" b'2 calculs', b'2 validite des reponses',\n",
|
||
" b'2 tests des possibilites', b' reconnaitre les theoremes',\n",
|
||
" b' validite des calculs', b' suivi du raisonnement geometrique',\n",
|
||
" b'1 quantite de sucre', b'2 calcul du volume', b'2 nombre de pots',\n",
|
||
" b\"3 dessin de l'etiquette\", b\"3 mise a l'echelle\",\n",
|
||
" b\"3 longueur de l'etiquette\", b' presentation'], dtype=object)"
|
||
]
|
||
},
|
||
"execution_count": 45,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df[\"q_name\"].unique()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 46,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"df = pd.merge(df, q_df, left_on=\"q_name\", right_on=\"q_name\")[[\"id_x\", \"id_y\", \"value\"]]\\\n",
|
||
" .rename(columns={\"id_x\": \"student_id\", \"id_y\": \"question_id\"})"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Yes ça y est je dois les avoir!"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 47,
|
||
"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>student_id</th>\n",
|
||
" <th>question_id</th>\n",
|
||
" <th>value</th>\n",
|
||
" </tr>\n",
|
||
" </thead>\n",
|
||
" <tbody>\n",
|
||
" <tr>\n",
|
||
" <th>0</th>\n",
|
||
" <td>1</td>\n",
|
||
" <td>400</td>\n",
|
||
" <td>3.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>1</th>\n",
|
||
" <td>2</td>\n",
|
||
" <td>400</td>\n",
|
||
" <td>6.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>2</th>\n",
|
||
" <td>3</td>\n",
|
||
" <td>400</td>\n",
|
||
" <td>2.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>3</th>\n",
|
||
" <td>4</td>\n",
|
||
" <td>400</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" <tr>\n",
|
||
" <th>4</th>\n",
|
||
" <td>5</td>\n",
|
||
" <td>400</td>\n",
|
||
" <td>0.0</td>\n",
|
||
" </tr>\n",
|
||
" </tbody>\n",
|
||
"</table>\n",
|
||
"</div>"
|
||
],
|
||
"text/plain": [
|
||
" student_id question_id value\n",
|
||
"0 1 400 3.0\n",
|
||
"1 2 400 6.0\n",
|
||
"2 3 400 2.0\n",
|
||
"3 4 400 0.0\n",
|
||
"4 5 400 0.0"
|
||
]
|
||
},
|
||
"execution_count": 47,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"df.head()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Et maintenant on sauvegarde tout!"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 48,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"df.to_sql(\"score\", conn, if_exists='append', index=False)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 30,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"ename": "NameError",
|
||
"evalue": "name 'fdsqfdsq' is not defined",
|
||
"output_type": "error",
|
||
"traceback": [
|
||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||
"\u001b[0;32m<ipython-input-30-a7adbbdd0ac1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfdsqfdsq\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
||
"\u001b[0;31mNameError\u001b[0m: name 'fdsqfdsq' is not defined"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"fdsqfdsq"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": []
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": []
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Fait au DNB blanc 1"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"wb = xlsxwriter.Workbook(\"DNB_BLANC_pro1.xlsx\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Formatages"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"eval_format = wb.add_format({'bold': True, 'font_color': 'red'})\n",
|
||
"eval_cell = wb.add_format()\n",
|
||
"eval_cell.set_bg_color(\"red\")\n",
|
||
"# exo_cell"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"La feuille de calcul"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"wb = xlsxwriter.Workbook(\"DS4_302.xlsx\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ws = wb.add_worksheet()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"En tête du tableau"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ws.write(0,1,\"Competence\")\n",
|
||
"ws.write(0,2,\"Barème\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"Toutes les questions et exercices"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"def q_line(q, row, ws):\n",
|
||
" ws.write(row, 0, f\"{q.name} - {q.comment}\")\n",
|
||
" ws.write(row, 1, f\"{q.competence}\")\n",
|
||
" ws.write(row, 2, q.score_rate)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"def exo_block(exo, row, ws):\n",
|
||
" qrow = row\n",
|
||
" for q in exo[\"questions\"]:\n",
|
||
" qrow += 1\n",
|
||
" q_line(q, qrow, ws)\n",
|
||
" ws.write(row, 0, f\"Ex {exo['name']}\")\n",
|
||
" row_range = \", \".join([f\"C{i}\" for i in range(row+2, qrow+2)])\n",
|
||
" for i in range(30):\n",
|
||
" ws.write(row, i+2, f\"=SUM({row_range})\")\n",
|
||
" return qrow"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true,
|
||
"scrolled": false
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"row = 2\n",
|
||
"exo_rows = []\n",
|
||
"for exo in ev.exercises:\n",
|
||
" exo_rows.append(row)\n",
|
||
" row = exo_block(exo, row, ws) + 1\n",
|
||
"ws.write(1,0, ev.name, eval_format)\n",
|
||
"exo_xls_range = \", \".join([f\"C{i+1}\" for i in exo_rows])\n",
|
||
"for i in range(30):\n",
|
||
" ws.write(1,i+2, f\"=SUM({exo_xls_range})\", eval_format)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"wb.close()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"# Avec openpyxl"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"from openpyxl import Workbook\n",
|
||
"from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font, colors"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"colors.RED"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"wb = Workbook()"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ws = wb.create_sheet(ev.name)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ws.cell(1,2,\"Competence\")\n",
|
||
"ws.cell(1,3,\"Barème\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"def q_line(q, row, ws):\n",
|
||
" ws.cell(row, 1, f\"{q.name} - {q.comment}\")\n",
|
||
" ws.cell(row, 2, f\"{q.competence}\")\n",
|
||
" ws.cell(row, 3, q.score_rate)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"def exo_block(exo, row, ws):\n",
|
||
" qrow = row\n",
|
||
" for q in exo[\"questions\"]:\n",
|
||
" qrow += 1\n",
|
||
" q_line(q, qrow, ws)\n",
|
||
" ws.cell(row, 1, f\"Ex {exo['name']}\")\n",
|
||
" row_range = \", \".join([f\"C{i}\" for i in range(row+1, qrow+1)])\n",
|
||
" ws.cell(row, 3, f\"=SUM({row_range})\")\n",
|
||
" return qrow"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"row = 3\n",
|
||
"exo_rows = []\n",
|
||
"for exo in ev.exercises:\n",
|
||
" exo_rows.append(row)\n",
|
||
" row = exo_block(exo, row, ws) + 1\n",
|
||
"eval_row = ws.row_dimensions[2]\n",
|
||
"eval_row.fill = PatternFill(bgColor=colors.RED)\n",
|
||
"ws.cell(2,1, ev.name)\n",
|
||
"exo_xls_range = \", \".join([f\"C{i}\" for i in exo_rows])\n",
|
||
"ws.cell(2,3, f\"=SUM({exo_xls_range})\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"ev.tribe"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"metadata": {
|
||
"collapsed": true
|
||
},
|
||
"outputs": [],
|
||
"source": [
|
||
"wb.save(f\"./{ev.name}-{ev.tribe}.xlsx\")"
|
||
]
|
||
},
|
||
{
|
||
"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.5"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 2
|
||
}
|