Add logger and "nn" note are dropped

This commit is contained in:
Benjamin Bertrand 2017-03-07 14:07:17 +03:00
parent bdf0f56c21
commit ddeb6de679

View File

@ -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)