Skip to content
Snippets Groups Projects
Commit e1bbb12f authored by Bruno Meyer's avatar Bruno Meyer
Browse files

aluno_turmas

parent 4cc96469
No related branches found
No related tags found
No related merge requests found
import pandas as pd
from utils.situations import *
def average_ira(d):
temp = d.dropna(subset=['MEDIA_FINAL'])
temp = temp[temp['MEDIA_FINAL'] <= 100]
if not temp.empty:
#print(temp[['MEDIA_FINAL', 'CH_TOTAL']])
aux = np.sum(temp['MEDIA_FINAL']*temp['CH_TOTAL'])
ch_total = np.sum(temp['CH_TOTAL']) * 100
print(aux/ch_total)
def aluno_turmas(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] = []
for s in Situation.SITUATIONS:
if(s[0] == df["SITUACAO"][i]):
situacao = s[1]
break
ano = (df["ANO"][i])
codigo = (df["COD_ATIV_CURRIC"][i])
nome = (df["NOME_ATIV_CURRIC"][i])
nota = (df["MEDIA_FINAL"][i])
semestre = (df["PERIODO"][i])
students[matr].append({
"ano": ano,
"codigo": codigo,
"nome": nome,
"nota": nota,
"semestre": semestre,
"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("")
......@@ -8,15 +8,6 @@ from json import load as json_load
from utils.situations import *
def teste(d):
temp = d.dropna(subset=['MEDIA_FINAL'])
temp = temp[temp['MEDIA_FINAL'] <= 100]
if not temp.empty:
#print(temp[['MEDIA_FINAL', 'CH_TOTAL']])
aux = np.sum(temp['MEDIA_FINAL']*temp['CH_TOTAL'])
ch_total = np.sum(temp['CH_TOTAL']) * 100
print(aux/ch_total)
class DataframeHolder:
def __init__(self, dataframe):
self.students = dataframe.groupby('MATR_ALUNO')
......@@ -111,4 +102,4 @@ def fix_evasion(df):
#~ if(x != 0.0):
#~ print(x)
#~ print(df.FORMA_EVASAO.str.contains(evasion[1]).fillna(5))
print(df[['MATR_ALUNO','FORMA_EVASAO']])
#~ print(df[['MATR_ALUNO','FORMA_EVASAO']])
......@@ -7,6 +7,7 @@ from datetime import timedelta
from pathlib import Path
from utils.utils import build_path
from analysis.degree_analysis import *
from analysis.student_analysis import *
try:
to_unicode = unicode
......@@ -22,7 +23,7 @@ def build_cache(dataframe):
build_path(path)
# generate_degree_data(path, dataframe)
# generate_student_data(path)
generate_student_data(path,dataframe)
# generate_student_list(path)
# generate_admission_data(path)
# generate_admission_list(path)
......@@ -35,7 +36,8 @@ def generate_degree_data(path, dataframe):
general_ira(dataframe)
pass
def generate_student_data(path):
def generate_student_data(path,dataframe):
aluno_turmas(dataframe)
pass
def generate_student_list(path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment