From ddeb6de679b0cf4c450d17d19c472b8a3e7faa84 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Tue, 7 Mar 2017 14:07:17 +0300 Subject: [PATCH] Add logger and "nn" note are dropped --- notes_tools/tools/df_marks_manip.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/notes_tools/tools/df_marks_manip.py b/notes_tools/tools/df_marks_manip.py index 64e12e6..64f0967 100644 --- a/notes_tools/tools/df_marks_manip.py +++ b/notes_tools/tools/df_marks_manip.py @@ -4,6 +4,8 @@ import pandas as pd import numpy as np from math import ceil +import logging +logger = logging.getLogger(__name__) # Values manipulations @@ -304,9 +306,11 @@ def compute_eval_marks(df): eval_m = pd.DataFrame() for eval_name in df["Nom"].unique(): + logger.debug(f"Compute marks for {eval_name}") eval_df = df[df["Nom"] == eval_name] dates = eval_df["Date"].unique() - if len(dates) > 1: + logger.debug(f"Find those dates: {dates}") + if len(dates) > 1 or dates[0] == "Trimestre": # Les devoirs sur la durée, les NaN ne sont pas pénalisants # On les enlèves eval_df = eval_df.dropna(subset=["Mark"]) @@ -371,9 +375,10 @@ def digest_flat_df(flat_df): 2 0 E1 N2 1 4.0 01/10/2016 3.0 0.75 3 1 E2 N2 1 4.0 01/10/2016 NaN NaN """ - df = flat_df.copy() - df["Mark"] = compute_marks(flat_df) - df["Latex_rep"] = compute_latex_rep(flat_df) + # Remove data with "nn" (non notés) + df = flat_df.copy()[flat_df["Note"] != "nn"] + df["Mark"] = compute_marks(df) + df["Latex_rep"] = compute_latex_rep(df) df["Normalized"] = compute_normalized(df) df["Uniq_quest"] = compute_question_description(df)