{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calcul des notes pour le calcul mental du T3\n",
"\n",
"Il y a 11 évaluations qu'on voudrait découper en 3 compétences."
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"from math import ceil\n",
"from repytex.tools.scores import mark_value_2level\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Élève | \n",
" CM01 | \n",
" CM02 | \n",
" CM03 | \n",
" CM04 | \n",
" CM05 | \n",
" CM06 | \n",
" CM07 | \n",
" CM08 | \n",
" CM09 | \n",
" CM10 | \n",
" CM11 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" ABDALLAH Laetitia | \n",
" 1.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
" 3.0 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 0.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
"
\n",
" \n",
" 1 | \n",
" ABDALLAH Lina | \n",
" 4.0 | \n",
" 3.0 | \n",
" 1.0 | \n",
" 3.0 | \n",
" 4.0 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
"
\n",
" \n",
" 2 | \n",
" ABDILLAH Naib | \n",
" 0.0 | \n",
" 1.0 | \n",
" NaN | \n",
" 0.0 | \n",
" 2.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 3.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
"
\n",
" \n",
" 3 | \n",
" ABDOU AHMED Zaher | \n",
" 4.0 | \n",
" 3.0 | \n",
" 3.0 | \n",
" 4.0 | \n",
" 4.0 | \n",
" 3.0 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 4.0 | \n",
" 3.0 | \n",
" 2.0 | \n",
"
\n",
" \n",
" 4 | \n",
" ABDOU Samima | \n",
" 3.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 3.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 1.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Élève CM01 CM02 CM03 CM04 CM05 CM06 CM07 CM08 CM09 \\\n",
"0 ABDALLAH Laetitia 1.0 1.0 2.0 4.0 3.0 3.0 2.0 2.0 0.0 \n",
"1 ABDALLAH Lina 4.0 3.0 1.0 3.0 4.0 3.0 2.0 1.0 1.0 \n",
"2 ABDILLAH Naib 0.0 1.0 NaN 0.0 2.0 1.0 2.0 2.0 3.0 \n",
"3 ABDOU AHMED Zaher 4.0 3.0 3.0 4.0 4.0 3.0 3.0 2.0 4.0 \n",
"4 ABDOU Samima 3.0 1.0 1.0 1.0 3.0 1.0 2.0 2.0 1.0 \n",
"\n",
" CM10 CM11 \n",
"0 2.0 4.0 \n",
"1 2.0 4.0 \n",
"2 1.0 0.0 \n",
"3 3.0 2.0 \n",
"4 2.0 2.0 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"score_file = \"./601_CM_T3.csv\"\n",
"df = pd.read_csv(score_file)\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Élève\n",
"ABDALLAH Laetitia [1.0, 1.0, 2.0, 4.0, 3.0, 3.0, 2.0, 2.0, 0.0, ...\n",
"ABDALLAH Lina [4.0, 3.0, 1.0, 3.0, 4.0, 3.0, 2.0, 1.0, 1.0, ...\n",
"ABDILLAH Naib [0.0, 1.0, 0.0, 2.0, 1.0, 2.0, 2.0, 3.0, 1.0, ...\n",
"ABDOU AHMED Zaher [4.0, 3.0, 3.0, 4.0, 4.0, 3.0, 3.0, 2.0, 4.0, ...\n",
"ABDOU Samima [3.0, 1.0, 1.0, 1.0, 3.0, 1.0, 2.0, 2.0, 1.0, ...\n",
"ABOUTOIHI Nasra [3.0, 4.0, 2.0, 4.0, 3.0, 3.0, 2.0, 2.0, 4.0, ...\n",
"AHAMADI SAID Aynoudine [4.0, 2.0, 1.0, 2.0, 4.0, 3.0, 3.0, 1.0, 2.0, ...\n",
"AHMED Rayna [3.0, 2.0, 1.0, 2.0, 4.0, 2.0, 2.0, 2.0, 3.0, ...\n",
"AKIDACHI Youssouf [4.0, 3.0, 4.0, 3.0, 2.0, 3.0, 3.0, 2.0, 2.0]\n",
"ALAWI Naim [1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 3.0, 1.0, 3.0, ...\n",
"ALI Estein [3.0, 3.0, 3.0, 4.0, 4.0, 3.0, 4.0, 2.0, 4.0]\n",
"ALLAOUI Nissouoiti [2.0, 1.0, 1.0, 3.0, 1.0, 2.0, 2.0, 1.0, 2.0]\n",
"ANDHUME OUSSENI Any [4.0, 3.0, 3.0, 3.0, 4.0, 2.0, 3.0, 4.0, 4.0, ...\n",
"ANDRE DICK Arson [4.0, 2.0, 3.0, 1.0, 3.0, 3.0, 2.0, 1.0, 3.0]\n",
"ANLI Aboubacar [2.0, 1.0, 3.0, 3.0, 4.0, 4.0, 2.0, 3.0, 2.0, ...\n",
"ATTOUMANE SAID Onzaïrati [1.0, 2.0, 2.0, 2.0, 3.0, 1.0, 2.0, 2.0, 1.0, ...\n",
"ATTOUMANI OUSSENI Arlette [1.0, 2.0, 3.0, 2.0, 3.0, 1.0, 3.0, 1.0, 3.0, ...\n",
"BACO Raissa [2.0, 2.0, 1.0, 1.0, 2.0, 1.0, 1.0, 2.0, 2.0]\n",
"CHARAFOU Bahati [2.0, 1.0, 0.0, 4.0, 4.0, 1.0, 4.0, 3.0, 2.0]\n",
"CHARF-EDDINE Iyane [1.0, 1.0, 3.0, 3.0, 4.0, 4.0, 3.0, 2.0, 4.0, ...\n",
"DAOU Ismaël [4.0, 4.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0, ...\n",
"HALIFA El -Enrif [1.0, 0.0, 1.0, 1.0, 3.0, 1.0, 2.0, 1.0, 3.0, ...\n",
"HAMADA Nadjima-Sophie [0.0, 2.0, 2.0, 1.0, 2.0, 1.0, 0.0, 2.0, 2.0]\n",
"HOUMADI Zahara [0.0, 1.0, 0.0, 2.0, 2.0, 1.0, 0.0, 1.0, 0.0, ...\n",
"IBRAHIM Nasser [1.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 2.0, 2.0, ...\n",
"dtype: object"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"st_scores = df.set_index(\"Élève\").unstack().dropna().groupby(\"Élève\").apply(lambda x: list(x))\n",
"st_scores"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[array([0, 1, 2, 3]), array([4, 5, 6]), array([7, 8, 9])]"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.array_split(list(range(10)), 3)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" sc0 | \n",
" sc1 | \n",
" sc2 | \n",
"
\n",
" \n",
" \n",
" \n",
" ABDALLAH Laetitia | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ABDALLAH Lina | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ABDILLAH Naib | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" ABDOU AHMED Zaher | \n",
" 3 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ABDOU Samima | \n",
" 1 | \n",
" 2 | \n",
" 1 | \n",
"
\n",
" \n",
" ABOUTOIHI Nasra | \n",
" 2 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" AHAMADI SAID Aynoudine | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" AHMED Rayna | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" AKIDACHI Youssouf | \n",
" 3 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ALAWI Naim | \n",
" 0 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ALI Estein | \n",
" 2 | \n",
" 3 | \n",
" 3 | \n",
"
\n",
" \n",
" ALLAOUI Nissouoiti | \n",
" 1 | \n",
" 2 | \n",
" 1 | \n",
"
\n",
" \n",
" ANDHUME OUSSENI Any | \n",
" 2 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" ANDRE DICK Arson | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ANLI Aboubacar | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" ATTOUMANE SAID Onzaïrati | \n",
" 1 | \n",
" 2 | \n",
" 1 | \n",
"
\n",
" \n",
" ATTOUMANI OUSSENI Arlette | \n",
" 2 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" BACO Raissa | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" CHARAFOU Bahati | \n",
" 1 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
" CHARF-EDDINE Iyane | \n",
" 2 | \n",
" 2 | \n",
" 3 | \n",
"
\n",
" \n",
" DAOU Ismaël | \n",
" 3 | \n",
" 3 | \n",
" 3 | \n",
"
\n",
" \n",
" HALIFA El -Enrif | \n",
" 1 | \n",
" 1 | \n",
" 2 | \n",
"
\n",
" \n",
" HAMADA Nadjima-Sophie | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" HOUMADI Zahara | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" IBRAHIM Nasser | \n",
" 1 | \n",
" 2 | \n",
" 2 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" sc0 sc1 sc2\n",
"ABDALLAH Laetitia 2 2 2\n",
"ABDALLAH Lina 2 2 2\n",
"ABDILLAH Naib 1 1 1\n",
"ABDOU AHMED Zaher 3 2 2\n",
"ABDOU Samima 1 2 1\n",
"ABOUTOIHI Nasra 2 2 3\n",
"AHAMADI SAID Aynoudine 2 2 2\n",
"AHMED Rayna 2 2 2\n",
"AKIDACHI Youssouf 3 2 2\n",
"ALAWI Naim 0 2 2\n",
"ALI Estein 2 3 3\n",
"ALLAOUI Nissouoiti 1 2 1\n",
"ANDHUME OUSSENI Any 2 2 3\n",
"ANDRE DICK Arson 2 2 2\n",
"ANLI Aboubacar 2 2 2\n",
"ATTOUMANE SAID Onzaïrati 1 2 1\n",
"ATTOUMANI OUSSENI Arlette 2 2 2\n",
"BACO Raissa 1 1 1\n",
"CHARAFOU Bahati 1 2 2\n",
"CHARF-EDDINE Iyane 2 2 3\n",
"DAOU Ismaël 3 3 3\n",
"HALIFA El -Enrif 1 1 2\n",
"HAMADA Nadjima-Sophie 1 1 1\n",
"HOUMADI Zahara 1 1 1\n",
"IBRAHIM Nasser 1 2 2"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"datas = {}\n",
"for e,v in st_scores.iteritems():\n",
" datas[e] = {}\n",
" for i, chunk in enumerate(np.array_split(v, 3)):\n",
" datas[e]['sc'+str(i)] = mark_value_2level(sum(chunk), 4*len(chunk))\n",
"datas = pd.DataFrame(datas).T\n",
"datas"
]
},
{
"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
}