class POV for term

This commit is contained in:
Benjamin Bertrand
2017-03-09 15:55:32 +03:00
parent e8e1220ecd
commit 412b174027
3 changed files with 71 additions and 5 deletions

View File

@@ -14,6 +14,8 @@ from notes_tools.tools.marks_plottings import (pie_pivot_table,
parallel_on,
radar_on,
)
import pandas as pd
import numpy as np
__all__ = ["Student", "Classe"]
@@ -112,11 +114,56 @@ class Student(object):
class Classe(object):
"""Docstring for Classe. """
"""
Informations on a class which can be use inside template.
Those informations should not be modify or use for compute analysis otherwise they won't be spread over other POV.
"""
def __init__(self):
"""TODO: to be defined1. """
pass
def __init__(self, quest_df, exo_df, eval_df):
""" Init of a class from quest, exo and eval """
self.quest_df = quest_df
self.exo_df = exo_df
self.eval_df = eval_df
@property
def evals_tabular(self):
""" Summary of all evaluations for all students """
try:
self._evals_tabular
except AttributeError:
self._evals_tabular = pd.pivot_table(self.eval_df,
index = "Eleve",
columns = "Nom",
values = "Mark_barem",
aggfunc = lambda x: " ".join(x)).to_latex()
return self._evals_tabular
@property
def parallel_on_evals(self):
""" Parallel coordinate plot of the class """
return parallel_on(self.eval_df, "Nom")
@property
def pies_eff_pts_on_competence(self):
""" Pie charts on competence with repartition of evaluated times and attributed points """
return pie_pivot_table(self.quest_df,
index = "Competence",
#columns = "Level",
values = "Bareme",
aggfunc=[len,np.sum],
fill_value=0)
@property
def pies_eff_pts_on_domaine(self):
""" Pie charts on domaine with repartition of evaluated times and attributed points """
return pie_pivot_table(self.quest_df,
index = "Domaine",
#columns = "Level",
values = "Bareme",
aggfunc=[len,np.sum],
fill_value=0)