diff --git a/script/analysis/student_analysis.py b/script/analysis/student_analysis.py index 326e5bc3e459a503860d12da43699e3a773cde85..d26d48db870d02870553cf74567ee848fb81de3e 100644 --- a/script/analysis/student_analysis.py +++ b/script/analysis/student_analysis.py @@ -10,6 +10,32 @@ def average_ira(d): ch_total = np.sum(temp['CH_TOTAL']) * 100 print(aux/ch_total) +def indice_aprovacao_semestral(df): + students = {} + df = df.dropna(subset=['MEDIA_FINAL']) + total_students = len(df["MATR_ALUNO"]) + for i in range(total_students): + matr = (df["MATR_ALUNO"][i]) + if(not (matr in students)): + students[matr] = {} + + + ano = str(df["ANO"][i]) + semestre = str(df["PERIODO"][i]) + situacao = int(df["SITUACAO"][i]) + + + if not(ano+"/"+semestre in students[matr]): + students[matr][ano+"/"+semestre] = [0,0] + + if(situacao in Situation.SITUATION_PASS): + students[matr][ano+"/"+semestre][0]+=1 + students[matr][ano+"/"+semestre][1]+=1 + if(situacao in Situation.SITUATION_FAIL): + students[matr][ano+"/"+semestre][1]+=1 + print(students) + + def aluno_turmas(df): students = {} df = df.dropna(subset=['MEDIA_FINAL']) @@ -38,26 +64,3 @@ def aluno_turmas(df): "situacao": situacao }) print(students) - #~ lines = (df[["MATR_ALUNO","ANO","COD_ATIV_CURRIC","NOME_ATIV_CURRIC","MEDIA_FINAL","PERIODO","SITUACAO"]]) - #~ for st in (df.groupby("MATR_ALUNO")): - #~ print(st[1]["MATR_ALUNO"]) - #~ print(st[1]["ANO"]) - #~ print(st[1]["COD_ATIV_CURRIC"]) - #~ print(st[1]["NOME_ATIV_CURRIC"]) - #~ print(st[1]["MEDIA_FINAL"]) - #~ print(st[1]["PERIODO"]) - #~ print(st[1]["SITUACAO"]) - #~ print("") - #~ total_student = df['MATR_ALUNO'].drop_duplicates() - #~ for st in total_student: - #~ students[st] = [] - #~ hist = df[df["MATR_ALUNO"]==st] - #~ for matr in hist: - #~ print(hist["ANO"]) - #~ print(hist[matr]["COD_ATIV_CURRIC"]) - #~ print(hist[matr]["NOME_ATIV_CURRIC"]) - #~ print(hist[matr]["MEDIA_FINAL"]) - #~ print(hist[matr]["PERIODO"]) - #~ print(hist[matr]["SITUACAO"]) - #~ print(hist[matr]) - #~ print("") diff --git a/script/build_cache.py b/script/build_cache.py index 4f358398d27a9e83577f65bcf34b1a9fe680103c..af57d36be9df1ecff2721aa6ad1b1c4a52bd8759 100644 --- a/script/build_cache.py +++ b/script/build_cache.py @@ -37,7 +37,8 @@ def generate_degree_data(path, dataframe): pass def generate_student_data(path,dataframe): - aluno_turmas(dataframe) + #~ aluno_turmas(dataframe) + indice_aprovacao_semestral(dataframe) pass def generate_student_list(path):