From ac64e5e44c8777e162bf21bb53449174c55b62f5 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Wed, 29 Mar 2017 05:28:51 +0300 Subject: [PATCH] Fill some column nan with "" --- notes_tools/tools/df_marks_manip.py | 6 +++++- notes_tools/tools/extract.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/notes_tools/tools/df_marks_manip.py b/notes_tools/tools/df_marks_manip.py index b231370..379f608 100644 --- a/notes_tools/tools/df_marks_manip.py +++ b/notes_tools/tools/df_marks_manip.py @@ -7,7 +7,7 @@ from math import ceil, floor import logging logger = logging.getLogger(__name__) -NOANSWER = "na" +NOANSWER = "." NORATED = "" # Values manipulations @@ -479,6 +479,10 @@ def digest_flat_df(flat_df): """ df = flat_df.dropna(subset=["Note"]) + df["Question"].fillna("", inplace = True) + df["Exercice"].fillna("", inplace = True) + df["Domaine"].fillna("", inplace = True) + df["Competence"].fillna("", inplace = True) df["Mark"] = compute_marks(df) df["Level"] = compute_level(df) df["Latex_rep"] = compute_latex_rep(df) diff --git a/notes_tools/tools/extract.py b/notes_tools/tools/extract.py index db2aaec..4636d3f 100644 --- a/notes_tools/tools/extract.py +++ b/notes_tools/tools/extract.py @@ -132,6 +132,11 @@ def extract_flat_marks(ws, flat = flat_df_students(sheet, students) flat_df = pd.concat([flat_df, flat]) + flat_df["Question"].fillna("", inplace = True) + flat_df["Exercice"].fillna("", inplace = True) + flat_df["Commentaire"].fillna("", inplace = True) + flat_df["Competence"].fillna("", inplace = True) + return flat_df