574 lines
28 KiB
Plaintext
574 lines
28 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"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": 2,
|
|||
|
"metadata": {
|
|||
|
"collapsed": false
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"{'classe': '313', 'date': '18 septembre 2015', 'titre': 'DM 1'}"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 2,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"ds_name = \"DM_15_09_18\"\n",
|
|||
|
"classe = \"313\"\n",
|
|||
|
"\n",
|
|||
|
"latex_info = {}\n",
|
|||
|
"latex_info['titre'] = \"DM 1\" \n",
|
|||
|
"latex_info['classe'] = \"313\"\n",
|
|||
|
"latex_info['date'] = \"18 septembre 2015\"\n",
|
|||
|
"latex_info"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# Import et premiers traitements"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 5,
|
|||
|
"metadata": {
|
|||
|
"collapsed": false,
|
|||
|
"scrolled": true
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"ename": "AssertionError",
|
|||
|
"evalue": "",
|
|||
|
"output_type": "error",
|
|||
|
"traceback": [
|
|||
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|||
|
"\u001b[1;31mAssertionError\u001b[0m Traceback (most recent call last)",
|
|||
|
"\u001b[1;32m<ipython-input-5-5d994dc2c0df>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mnotes\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mExcelFile\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"./../../../313_.xlsx\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[0mnotes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msheet_names\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mnotes\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnotes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mparse\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mds_name\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/pandas/io/excel.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, io, **kwds)\u001b[0m\n\u001b[0;32m 186\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbook\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mxlrd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mopen_workbook\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile_contents\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 187\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 188\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbook\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mxlrd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mopen_workbook\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mio\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 189\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mengine\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'xlrd'\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mio\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mxlrd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mBook\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 190\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbook\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mio\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/xlrd/__init__.py\u001b[0m in \u001b[0;36mopen_workbook\u001b[1;34m(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)\u001b[0m\n\u001b[0;32m 414\u001b[0m \u001b[0mformatting_info\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mformatting_info\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 415\u001b[0m \u001b[0mon_demand\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mon_demand\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 416\u001b[1;33m \u001b[0mragged_rows\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mragged_rows\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 417\u001b[0m )\n\u001b[0;32m 418\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mbk\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/xlrd/xlsx.py\u001b[0m in \u001b[0;36mopen_workbook_2007_xml\u001b[1;34m(zf, component_names, logfile, verbosity, use_mmap, formatting_info, on_demand, ragged_rows)\u001b[0m\n\u001b[0;32m 789\u001b[0m \u001b[0mx12sheet\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mX12Sheet\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msheet\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlogfile\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mverbosity\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 790\u001b[0m \u001b[0mheading\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"Sheet %r (sheetx=%d) from %r\"\u001b[0m \u001b[1;33m%\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0msheet\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msheetx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 791\u001b[1;33m \u001b[0mx12sheet\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mprocess_stream\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mzflo\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mheading\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 792\u001b[0m \u001b[1;32mdel\u001b[0m \u001b[0mzflo\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 793\u001b[0m \u001b[0mcomments_fname\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'xl/comments%d.xml'\u001b[0m \u001b[1;33m%\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0msheetx\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/xlrd/xlsx.py\u001b[0m in \u001b[0;36mown_process_stream\u001b[1;34m(self, stream, heading)\u001b[0m\n\u001b[0;32m 529\u001b[0m \u001b[0melem\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclear\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# destroy all child elements (cells)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 530\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0melem\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtag\u001b[0m \u001b[1;33m==\u001b[0m \u001b[0mU_SSML12\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m\"dimension\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 531\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdo_dimension\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0melem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 532\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0melem\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtag\u001b[0m \u001b[1;33m==\u001b[0m \u001b[0mU_SSML12\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m\"mergeCell\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 533\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdo_merge_cell\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0melem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/xlrd/xlsx.py\u001b[0m in \u001b[0;36mdo_dimension\u001b[1;34m(self, elem)\u001b[0m\n\u001b[0;32m 563\u001b[0m \u001b[1;31m# print >> self.logfile, \"dimension: ref=%r\" % ref\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 564\u001b[0m \u001b[0mlast_cell_ref\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mref\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m':'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;31m# example: \"Z99\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 565\u001b[1;33m \u001b[0mrowx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcell_name_to_rowx_colx\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlast_cell_ref\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 566\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msheet\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_dimnrows\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrowx\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 567\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msheet\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_dimncols\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcolx\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;32m/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/xlrd/xlsx.py\u001b[0m in \u001b[0;36mcell_name_to_rowx_colx\u001b[1;34m(cell_name, letter_value)\u001b[0m\n\u001b[0;32m 87\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# start of row number; can't be '0'\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 88\u001b[0m \u001b[0mcolx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcolx\u001b[0m \u001b[1;33m-\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 89\u001b[1;33m \u001b[1;32massert\u001b[0m \u001b[1;36m0\u001b[0m \u001b[1;33m<=\u001b[0m \u001b[0mcolx\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0mX12_MAX_COLS\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 90\u001b[0m \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 91\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
|
|||
|
"\u001b[1;31mAssertionError\u001b[0m: "
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"notes = pd.ExcelFile(\"./../../../313_.xlsx\")\n",
|
|||
|
"notes.sheet_names\n",
|
|||
|
"notes = notes.parse(ds_name)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 8,
|
|||
|
"metadata": {
|
|||
|
"collapsed": false
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"ename": "NameError",
|
|||
|
"evalue": "name 'notes' is not defined",
|
|||
|
"output_type": "error",
|
|||
|
"traceback": [
|
|||
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|||
|
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
|||
|
"\u001b[1;32m<ipython-input-8-a47dece6e491>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mnotes\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mindex\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
|
|||
|
"\u001b[1;31mNameError\u001b[0m: name 'notes' is not defined"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"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+ABwb3fhSZIWMbeoJ9kPHAF+F8iEKUeB+w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Kyb9kdc9kt89kvi7okDYg9dUk7yp765uPtqUuSprKoLyn7lt0xl90yn/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
|
|||
|
}
|