{ "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ÉlèveCM01CM02CM03CM04CM05CM06CM07CM08CM09CM10CM11
0ABDALLAH Laetitia1.01.02.04.03.03.02.02.00.02.04.0
1ABDALLAH Lina4.03.01.03.04.03.02.01.01.02.04.0
2ABDILLAH Naib0.01.0NaN0.02.01.02.02.03.01.00.0
3ABDOU AHMED Zaher4.03.03.04.04.03.03.02.04.03.02.0
4ABDOU Samima3.01.01.01.03.01.02.02.01.02.02.0
\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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sc0sc1sc2
ABDALLAH Laetitia222
ABDALLAH Lina222
ABDILLAH Naib111
ABDOU AHMED Zaher322
ABDOU Samima121
ABOUTOIHI Nasra223
AHAMADI SAID Aynoudine222
AHMED Rayna222
AKIDACHI Youssouf322
ALAWI Naim022
ALI Estein233
ALLAOUI Nissouoiti121
ANDHUME OUSSENI Any223
ANDRE DICK Arson222
ANLI Aboubacar222
ATTOUMANE SAID Onzaïrati121
ATTOUMANI OUSSENI Arlette222
BACO Raissa111
CHARAFOU Bahati122
CHARF-EDDINE Iyane223
DAOU Ismaël333
HALIFA El -Enrif112
HAMADA Nadjima-Sophie111
HOUMADI Zahara111
IBRAHIM Nasser122
\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 }