specify columns in notstudent
This commit is contained in:
parent
6326c57a53
commit
954c2ac027
@ -9,7 +9,16 @@ from path import Path
|
|||||||
|
|
||||||
notes_path = Path("./")
|
notes_path = Path("./")
|
||||||
|
|
||||||
notStudent = ["Trimestre", "Nom", "Date", "Exercice", "Question", "Competence", "Domaine", "Commentaire", "Bareme", "Niveau"]
|
no_student_columns = ["Trimestre",
|
||||||
|
"Nom",
|
||||||
|
"Date",
|
||||||
|
"Exercice",
|
||||||
|
"Question",
|
||||||
|
"Competence",
|
||||||
|
"Domaine",
|
||||||
|
"Commentaire",
|
||||||
|
"Bareme",
|
||||||
|
"Niveau"]
|
||||||
|
|
||||||
pd.set_option("Precision",2)
|
pd.set_option("Precision",2)
|
||||||
|
|
||||||
@ -41,12 +50,12 @@ def get_class_ws(classe, path = notes_path):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("This class is not disponible in {p}. You have to choose in {c}".format(p = p, c = list_classes(p)))
|
raise ValueError("This class is not disponible in {p}. You have to choose in {c}".format(p = p, c = list_classes(p)))
|
||||||
|
|
||||||
def extract_students(df, notStudent = notStudent):
|
def extract_students(df, no_student_columns = no_student_columns):
|
||||||
""" Extract the list of students from df """
|
""" Extract the list of students from df """
|
||||||
students = df.columns.difference(notStudent)
|
students = df.columns.difference(no_student_columns)
|
||||||
return students
|
return students
|
||||||
|
|
||||||
def check_students(dfs, notStudent = notStudent):
|
def check_students(dfs, no_student_columns = no_student_columns):
|
||||||
""" Build students list """
|
""" Build students list """
|
||||||
dfs_students = [extract_students(df) for df in dfs]
|
dfs_students = [extract_students(df) for df in dfs]
|
||||||
|
|
||||||
@ -81,7 +90,7 @@ def flat_df_students(df, students):
|
|||||||
flat_data = []
|
flat_data = []
|
||||||
dfT = df.T
|
dfT = df.T
|
||||||
for n in dfT:
|
for n in dfT:
|
||||||
pre_di = dfT[n][notStudent].to_dict()
|
pre_di = dfT[n][no_student_columns].to_dict()
|
||||||
for e in students:
|
for e in students:
|
||||||
data = pre_di.copy()
|
data = pre_di.copy()
|
||||||
data["Eleve"] = e
|
data["Eleve"] = e
|
||||||
|
Loading…
Reference in New Issue
Block a user