2014-2015/tools/skeleton/Bilan.ipynb

559 lines
19 KiB
Plaintext
Raw Normal View History

2017-06-16 06:48:07 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 120,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pandas as pd\n",
"from opytex import texenv\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Informations sur le devoir"
]
},
{
"cell_type": "code",
"execution_count": 121,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"{'classe': '\\\\seconde', 'date': '6 mai 2015', 'titre': 'DM 4'}"
]
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds_name = \n",
"classe = \n",
"\n",
"latex_info = {}\n",
"latex_info['titre'] = \n",
"latex_info['classe'] = \n",
"latex_info['date'] = \n",
"latex_info"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Import et premiers traitements"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
"notes = pd.ExcelFile(\"./../../../notes_\"+classe+\".xls\")\n",
"notes.sheet_names\n",
"notes = notes.parse(ds_name)"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['DM_0506', 'av_arrondi', 'num_sujet', 'Malus', 'Exercice 1', '1.1.a',\n",
" '1.1.b', '1.1.c', '1.2.a', '1.2.b', '1.2.c', '1.2.d', '1.3.a', '1.3.b',\n",
" '1.3.c', '1.3.d', 'Exercice 2', '2.1', '2.2', '2.3', 'Exercice 3',\n",
" '3.1.a', '3.1.b', '3.1.c', '3.1.d', '3.2.a', '3.2.b', '3.2.c', '3.2.d'],\n",
" dtype='object')"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"notes.index"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"notes = notes.T"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes = notes.drop('av_arrondi', axis=1)\n",
"notes = notes.drop('num_sujet', axis=1)"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"barem = notes[:1]\n",
"notes = notes[1:]\n",
"#notes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Supression des notes inutiles "
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes = notes[notes[ds_name].notnull()]\n",
"notes = notes[notes[ds_name] != 'abs']"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes = notes.astype(float)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Traitement des notes"
]
},
{
"cell_type": "code",
"execution_count": 129,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['DM_0506', 'Malus', 'Exercice 1', '1.1.a', '1.1.b', '1.1.c', '1.2.a',\n",
" '1.2.b', '1.2.c', '1.2.d', '1.3.a', '1.3.b', '1.3.c', '1.3.d',\n",
" 'Exercice 2', '2.1', '2.2', '2.3', 'Exercice 3', '3.1.a', '3.1.b',\n",
" '3.1.c', '3.1.d', '3.2.a', '3.2.b', '3.2.c', '3.2.d'],\n",
" dtype='object')"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"notes.T.index"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"list_exo = [\"Exercice 1\", \"Exercice 2\", \"Exercice 3\"]"
]
},
{
"cell_type": "code",
"execution_count": 131,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes[list_exo] = notes[list_exo].applymap(lambda x:round(x,2))\n",
"#notes[list_exo]"
]
},
{
"cell_type": "code",
"execution_count": 132,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"['1.1.a',\n",
" '1.1.b',\n",
" '1.1.c',\n",
" '1.2.a',\n",
" '1.2.b',\n",
" '1.2.c',\n",
" '1.2.d',\n",
" '1.3.a',\n",
" '1.3.b',\n",
" '1.3.c',\n",
" '1.3.d',\n",
" '2.1',\n",
" '2.2',\n",
" '2.3',\n",
" '3.1.a',\n",
" '3.1.b',\n",
" '3.1.c',\n",
" '3.1.d',\n",
" '3.2.a',\n",
" '3.2.b',\n",
" '3.2.c',\n",
" '3.2.d']"
]
},
"execution_count": 132,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"item_avec_note = list_exo + [ds_name, \"Malus\"]\n",
"sous_exo = [i for i in notes.T.index if i not in item_avec_note]\n",
"sous_exo"
]
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def toRepVal(val):\n",
" if pd.isnull(val):\n",
" return \"\\\\NoRep\"\n",
" elif val == 0:\n",
" return \"\\\\RepZ\"\n",
" elif val == 1:\n",
" return \"\\\\RepU\"\n",
" elif val == 2:\n",
" return \"\\\\RepD\"\n",
" elif val == 3:\n",
" return \"\\\\RepT\"\n",
" else:\n",
" return val"
]
},
{
"cell_type": "code",
"execution_count": 134,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes[item_avec_note] = notes[item_avec_note].fillna(\".\")\n",
"#notes"
]
},
{
"cell_type": "code",
"execution_count": 135,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"eleves = notes.copy()\n",
"eleves[sous_exo] = notes[sous_exo].applymap(toRepVal)"
]
},
{
"cell_type": "code",
"execution_count": 136,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"27"
]
},
"execution_count": 136,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(notes.T.index)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Preparation du fichier .tex"
]
},
{
"cell_type": "code",
"execution_count": 157,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"bilan = texenv.get_template(\"tpl_bilan.tex\")\n",
"with open(\"./bilan.tex\",\"w\") as f:\n",
" f.write(bilan.render(eleves = eleves, barem = barem, ds_name = ds_name, latex_info = latex_info, nbr_questions = len(barem.T)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Un peu de statistiques"
]
},
{
"cell_type": "code",
"execution_count": 138,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"count 28.000000\n",
"mean 14.696429\n",
"std 5.894661\n",
"min 0.000000\n",
"25% 14.375000\n",
"50% 16.500000\n",
"75% 18.625000\n",
"max 20.000000\n",
"Name: DM_0506, dtype: float64"
]
},
"execution_count": 138,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"notes[ds_name].describe()"
]
},
{
"cell_type": "code",
"execution_count": 139,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f761323dbe0>"
]
},
"execution_count": 139,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEACAYAAABMEua6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE8BJREFUeJzt3X+MZfdZ3/H3x15HIYSygkjbxLvVIMVB2ELsEslZOVSe\n9JfsVbvQKoJYioJTqVmVbmOlKgKkAOYv+CfUdXCdlXCypqpiRUEYB21IQrPjJqq0DsS7rJN1a4u4\n2IGskRxbSRYkL376x5yx71zfH+fOnpkz9/j9kkZzv+d8z7nPPHv2mTPPfO+dVBWSpGG4qu8AJEnd\nsahL0oBY1CVpQCzqkjQgFnVJGhCLuiQNSKuinuTqJI8m+cyU/XcneSLJuSSHug1RktRW2zv1O4Cv\nA69a1J7kCPDWqroO+ABwb3fhSZIWMbeoJ9k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bz7e\nnrokaSqL+pKyb9kdc9kt89kvi7okDYg9dUk7yp765uPtqUuSprKoLyn7lt0xl90yn/2yqEvSgNhT\nl7Sj7KlvPt6euiRpKov6krJv2R1z2S3z2a+5RT3Jx5NcTHJ+yv7VJC+M/FHqD3cfpiSpjbl/eBr4\nBPBR4PdmzHm4qo52E5LaqKq1vmMYCnPZLfPZr7l36lX1JeDbc6Zt+ZcRkqTudNFTL+CmJOeSnEpy\nfQfn1Bz2LbtjLrtlPvvVpv0yz1eBA1V1KcmtwIPA2yZPvR1YaR7vBQ4Cq8348p4kqxs/um1cGI4n\nj4GDSXZNPI4dLzKG5tPL///Hxxvbtrp/jVFbjXfzcy1+/rbHb96/BpxsxissqtU69SQrwGeq6sdb\nzP0G8Paqem5su+vUJbl
"text/plain": [
"<matplotlib.figure.Figure at 0x7f76133ec630>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"notes_seules = notes[ds_name]\n",
"notes_seules.hist(bins = (notes_seules.max() - notes_seules.min())*2)"
]
},
{
"cell_type": "code",
"execution_count": 154,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"notes_questions = notes[sous_exo]\n",
"notes_analysis = notes_questions.describe()"
]
},
{
"cell_type": "code",
"execution_count": 155,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>1.1.a</th>\n",
" <th>1.1.b</th>\n",
" <th>1.1.c</th>\n",
" <th>1.2.a</th>\n",
" <th>1.2.b</th>\n",
" <th>1.2.c</th>\n",
" <th>1.2.d</th>\n",
" <th>1.3.a</th>\n",
" <th>1.3.b</th>\n",
" <th>1.3.c</th>\n",
" <th>...</th>\n",
" <th>2.2</th>\n",
" <th>2.3</th>\n",
" <th>3.1.a</th>\n",
" <th>3.1.b</th>\n",
" <th>3.1.c</th>\n",
" <th>3.1.d</th>\n",
" <th>3.2.a</th>\n",
" <th>3.2.b</th>\n",
" <th>3.2.c</th>\n",
" <th>3.2.d</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>25</td>\n",
" <td>25</td>\n",
" <td>25</td>\n",
" <td>25</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>25</td>\n",
" <td>25</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>25</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1 rows × 22 columns</p>\n",
"</div>"
],
"text/plain": [
" 1.1.a 1.1.b 1.1.c 1.2.a 1.2.b 1.2.c 1.2.d 1.3.a 1.3.b 1.3.c \\\n",
"count 25 25 25 25 NaN NaN NaN 25 25 NaN \n",
"\n",
" ... 2.2 2.3 3.1.a 3.1.b 3.1.c 3.1.d 3.2.a 3.2.b 3.2.c 3.2.d \n",
"count ... NaN 25 NaN NaN NaN NaN NaN NaN NaN NaN \n",
"\n",
"[1 rows x 22 columns]"
]
},
"execution_count": 155,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# J'aimerai récupérer le nom des questions qui ont été le moins répondus\n",
"notes_analysis[:1][notes_analysis[:1] == 25]"
]
},
{
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}