diff --git a/script/analysis/student_analysis.py b/script/analysis/student_analysis.py index 7513042ecc47bb1388074adf8f211d19119bcd5d..959863e2de924a407ff99c661bde2c7a57882830 100644 --- a/script/analysis/student_analysis.py +++ b/script/analysis/student_analysis.py @@ -2,8 +2,8 @@ import pandas as pd from utils.situations import * -ANO_ATUAL = 2018 -SEMESTRE_ATUAL = 1 +ANO_ATUAL = 2017 +SEMESTRE_ATUAL = 2 def average_ira(d): temp = d.dropna(subset=['MEDIA_FINAL']) @@ -14,6 +14,29 @@ def average_ira(d): ch_total = np.sum(temp['CH_TOTAL']) * 100 return(aux/ch_total) +def posicao_turmaIngresso_semestral(df): + iras = ira_semestra(df) + iraMax = {} + for matr in iras: + for semestreAno in iras[matr]: + if not(semestreAno in iraMax): + iraMax[semestreAno] = iras[matr][semestreAno] + else: + if(iras[matr][semestreAno] > iraMax[semestreAno]): + iraMax[semestreAno] = iras[matr][semestreAno] + for matr in iras: + for semestreAno in iras[matr]: + iras[matr][semestreAno]/=iraMax[semestreAno] + + return iras + +def periodo_real(df): + aux = df.groupby(["MATR_ALUNO"]) + students = {} + for x in aux: + students[x[0]] = None + return students + def periodo_pretendido(df): aux = df.groupby(["MATR_ALUNO","ANO_INGRESSO","SEMESTRE_INGRESSO"]) students = {} @@ -31,7 +54,13 @@ def ira_semestra(df): def ira_por_quantidade_disciplinas(df): students = {} - df = df.dropna(subset=['MEDIA_FINAL']) + df = df.dropna(subset=["MEDIA_FINAL"]) + #~ print(df["MATR_ALUNO"][178]) + #~ print(df["NOME_ATIV_CURRIC"][178]) + #~ print(df["PERIODO"][178]) + #~ print(df["ANO"][178]) + #~ print(df["SITUACAO"][178]) + total_students = len(df["MATR_ALUNO"]) for i in range(total_students): matr = (df["MATR_ALUNO"][i]) @@ -39,20 +68,24 @@ def ira_por_quantidade_disciplinas(df): students[matr] = {} + ano = str(int(df["ANO"][i])) semestre = str(df["PERIODO"][i]) situacao = int(df["SITUACAO"][i]) nota = float(df["MEDIA_FINAL"][i]) + media_credito = int(df["MEDIA_CREDITO"][i]) - - - if(situacao in Situation.SITUATION_AFFECT_IRA): + if(situacao in Situation.SITUATION_AFFECT_IRA and media_credito != 0): + + + if not(ano+"/"+semestre in students[matr]): students[matr][ano+"/"+semestre] = [0,0] students[matr][ano+"/"+semestre][0]+=nota students[matr][ano+"/"+semestre][1]+=1 - + + for matr in students: for periodo in students[matr]: if(students[matr][periodo][1] != 0): diff --git a/script/build_cache.py b/script/build_cache.py index 69c12ee6fa75bbc3528c2ff60f9796452dc23943..4b9dae3b9e449408f12d32789332fe3708354f24 100644 --- a/script/build_cache.py +++ b/script/build_cache.py @@ -39,13 +39,15 @@ def generate_degree_data(path, dataframe): def generate_student_data(path,dataframe): #~ print(aluno_turmas(dataframe)) #~ print(indice_aprovacao_semestral(dataframe)) - #~ print(ira_por_quantidade_disciplinas(dataframe)) - #~ print(ira_semestra(dataframe)) + #~ print("2007/1" in ira_por_quantidade_disciplinas(dataframe)["GRR20066955"]) + #~ print(ira_semestra(dataframe)["GRR20079775"]) #~ aluno_turmas(dataframe) #~ indice_aprovacao_semestral(dataframe) #~ ira_por_quantidade_disciplinas(dataframe) #~ ira_semestra(dataframe) - periodo_pretendido(dataframe) + #~ periodo_pretendido(dataframe) + #~ print(periodo_real(dataframe)) + print(posicao_turmaIngresso_semestral(dataframe)) pass def generate_student_list(path):