Import work from year 2014-2015
This commit is contained in:
422
1S/DM/DM_0504/Bilan/Bilan DM_0504.ipynb
Normal file
422
1S/DM/DM_0504/Bilan/Bilan DM_0504.ipynb
Normal file
@@ -0,0 +1,422 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"from texenv import texenv\n",
|
||||
"%matplotlib inline"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Informations sur le devoir"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'classe': '\\\\premiereS', 'date': '4 mai 2015', 'titre': 'DM 7'}"
|
||||
]
|
||||
},
|
||||
"execution_count": 36,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"ds_name = \"DM_0504\"\n",
|
||||
"classe = \"1S\"\n",
|
||||
"\n",
|
||||
"latex_info = {}\n",
|
||||
"latex_info['titre'] = 'DM 7'\n",
|
||||
"latex_info['classe'] = \"\\\\premiereS\"\n",
|
||||
"latex_info['date'] = '4 mai 2015'\n",
|
||||
"latex_info"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Import et premiers traitements"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"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": 16,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Index(['DM_0504', 'a_arrondi', 'Malus', 'Exercice 1', '1.1.a (domaines)',\n",
|
||||
" '1.1.b (Dérivée)', '1.1.c (Variations)', '1.2.a (domaines)',\n",
|
||||
" '1.2.b (Dérivée)', '1.2.c (Variations)', '1.3.a (Courbe)',\n",
|
||||
" '1.3.b (Intersection)', '1.3.c (Resolution graphique)', '1 Malus',\n",
|
||||
" 'Exercice 2', '2.1 (variations)', '2.2.a (Equation tangente)',\n",
|
||||
" '2.2.b (Position tangente)', '2.2.c (Courbe)', 'Exercice 3',\n",
|
||||
" '3.1 (domaines)', '3.2 (variations)'],\n",
|
||||
" dtype='object')"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"notes.index"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"notes = notes.T"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"notes = notes.drop('a_arrondi', axis=1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"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": 21,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"notes = notes[notes[ds_name].notnull()]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"notes = notes.astype(float)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Liste des exercices (donc notés)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"list_exo = [\"Exercice 1\", \"Exercice 2\", \"Exercice 3\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"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": 26,
|
||||
"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": 47,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Index(['DM_0504', 'Malus', 'Exercice 1', '1.1.a (domaines)', '1.1.b (Dérivée)',\n",
|
||||
" '1.1.c (Variations)', '1.2.a (domaines)', '1.2.b (Dérivée)',\n",
|
||||
" '1.2.c (Variations)', '1.3.a (Courbe)', '1.3.b (Intersection)',\n",
|
||||
" '1.3.c (Resolution graphique)', '1 Malus', 'Exercice 2',\n",
|
||||
" '2.1 (variations)', '2.2.a (Equation tangente)',\n",
|
||||
" '2.2.b (Position tangente)', '2.2.c (Courbe)', 'Exercice 3',\n",
|
||||
" '3.1 (domaines)', '3.2 (variations)'],\n",
|
||||
" dtype='object')"
|
||||
]
|
||||
},
|
||||
"execution_count": 47,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"notes.T.index"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['1.1.a (domaines)',\n",
|
||||
" '1.1.b (Dérivée)',\n",
|
||||
" '1.1.c (Variations)',\n",
|
||||
" '1.2.a (domaines)',\n",
|
||||
" '1.2.b (Dérivée)',\n",
|
||||
" '1.2.c (Variations)',\n",
|
||||
" '1.3.a (Courbe)',\n",
|
||||
" '1.3.b (Intersection)',\n",
|
||||
" '1.3.c (Resolution graphique)',\n",
|
||||
" '2.1 (variations)',\n",
|
||||
" '2.2.a (Equation tangente)',\n",
|
||||
" '2.2.b (Position tangente)',\n",
|
||||
" '2.2.c (Courbe)',\n",
|
||||
" '3.1 (domaines)',\n",
|
||||
" '3.2 (variations)']"
|
||||
]
|
||||
},
|
||||
"execution_count": 49,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"item_avec_note = list_exo + [ds_name, \"1 Malus\", \"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": 52,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/lafrite/.virtualenvs/enseignement/lib/python3.4/site-packages/pandas/core/frame.py:2142: SettingWithCopyWarning: \n",
|
||||
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
||||
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
||||
"\n",
|
||||
"See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
|
||||
" self[k1] = value[k2]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"notes[sous_exo] = notes[sous_exo].applymap(toRepVal)\n",
|
||||
"notes[item_avec_note] = notes[item_avec_note].fillna(\".\")\n",
|
||||
"#notes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 53,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"21"
|
||||
]
|
||||
},
|
||||
"execution_count": 53,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(notes.T.index)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Preparation du fichier .tex"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 54,
|
||||
"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 = notes, 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": 23,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"count 30.000000\n",
|
||||
"mean 11.016667\n",
|
||||
"std 5.414672\n",
|
||||
"min 0.000000\n",
|
||||
"25% 8.375000\n",
|
||||
"50% 12.250000\n",
|
||||
"75% 14.500000\n",
|
||||
"max 19.500000\n",
|
||||
"Name: DM_0504, dtype: float64"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"notes[ds_name].describe()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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
|
||||
}
|
||||
BIN
1S/DM/DM_0504/Bilan/bilan.pdf
Normal file
BIN
1S/DM/DM_0504/Bilan/bilan.pdf
Normal file
Binary file not shown.
3125
1S/DM/DM_0504/Bilan/bilan.tex
Normal file
3125
1S/DM/DM_0504/Bilan/bilan.tex
Normal file
File diff suppressed because it is too large
Load Diff
30
1S/DM/DM_0504/Bilan/texenv.py
Normal file
30
1S/DM/DM_0504/Bilan/texenv.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import jinja2, os
|
||||
|
||||
# Definition of jinja syntax for latex
|
||||
texenv = jinja2.Environment(
|
||||
block_start_string = '\Block{',
|
||||
# Gros WTF!! Si on le met en maj ça ne marche pas alors que c'est en maj dans le template...
|
||||
block_end_string = '}',
|
||||
variable_start_string = '\Var{',
|
||||
variable_end_string = '}',
|
||||
loader = jinja2.FileSystemLoader(os.path.abspath('.')),
|
||||
extensions = ['jinja2.ext.do']
|
||||
)
|
||||
|
||||
# Filters
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from pymath.expression import Expression
|
||||
exp = Expression("2/4 + 18")
|
||||
print(do_calculus(exp.simplify()))
|
||||
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||||
# cursor: 16 del
|
||||
79
1S/DM/DM_0504/Bilan/tpl_bilan.tex
Normal file
79
1S/DM/DM_0504/Bilan/tpl_bilan.tex
Normal file
@@ -0,0 +1,79 @@
|
||||
\documentclass{/media/documents/Cours/Prof/Enseignements/2014-2015/Archive/2014-2015/tools/style/classBilan}
|
||||
\usepackage{/media/documents/Cours/Prof/Enseignements/2014-2015/Archive/2014-2015/2014_2015}
|
||||
|
||||
\usepackage{multicol}
|
||||
|
||||
% Title Page
|
||||
\titre{\Var{latex_info['titre']}}
|
||||
% \seconde \premiereS \PSTMG \TSTMG
|
||||
\classe{\Var{latex_info['classe']}}
|
||||
\date{\Var{latex_info['date']}}
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
\Block{for (name, notes) in eleves.iterrows()}
|
||||
\maketitle
|
||||
|
||||
\begin{minipage}{0.5\linewidth}
|
||||
\large
|
||||
\Var{name}
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.3\linewidth}
|
||||
\begin{flushright}
|
||||
\Large \Var{notes[ds_name]} / \Var{barem[ds_name][0]}
|
||||
\end{flushright}
|
||||
\end{minipage}
|
||||
|
||||
\vfill
|
||||
|
||||
\fbox{%
|
||||
\begin{minipage}{0.9\linewidth}
|
||||
\hfill
|
||||
\vspace{3cm}
|
||||
\end{minipage}
|
||||
}
|
||||
|
||||
\vfill
|
||||
|
||||
\scriptsize
|
||||
\begin{multicols}{2}
|
||||
\begin{tabular}{|p{3cm}|c|c|}
|
||||
\hline
|
||||
\rowcolor{highlightbg} Exercices & Réussite & Barème \\
|
||||
\hline
|
||||
\Block{for question in barem.T[1:(nbr_questions//2)].T}
|
||||
\Var{question} & \Var{notes[question]} & \Var{barem[question][0]} \\
|
||||
\hline
|
||||
\Block{endfor}
|
||||
\end{tabular}
|
||||
|
||||
\begin{tabular}{|p{3cm}|c|c|}
|
||||
\hline
|
||||
\rowcolor{highlightbg} Exercices & Réussite & Barème \\
|
||||
\hline
|
||||
\Block{for question in barem.T[11:].T}
|
||||
\Var{question} & \Var{notes[question]} & \Var{barem[question][0]} \\
|
||||
\hline
|
||||
\Block{endfor}
|
||||
\end{tabular}
|
||||
\end{multicols}
|
||||
|
||||
%\begin{tabular}{|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
|
||||
% \hline
|
||||
% Pas de réponse & Faux & Peu juste & Partiellement juste & Juste \\
|
||||
% \hline
|
||||
% \NoRep & \RepZ & \RepU & \RepD & \RepT \\
|
||||
% \hline
|
||||
%\end{tabular}
|
||||
\normalsize
|
||||
\pagebreak
|
||||
\Block{endfor}
|
||||
|
||||
\end{document}
|
||||
|
||||
%%% Local Variables:
|
||||
%%% mode: latex
|
||||
%%% TeX-master: "master"
|
||||
%%% End:
|
||||
|
||||
Reference in New Issue
Block a user