Commit 8951cd19 authored by Legton's avatar Legton
Browse files

fix merge conflicts

parents 7d018ce8 e1bbb12f
import re
import pandas as pd
import numpy as np
from utils.situations import *
def average_ira(df):
print(df)
new_df = df.dropna(subset=['MEDIA_FINAL'])
new_df = new_df[new_df['MEDIA_FINAL'] <= 100]
if not new_df.empty:
grade = np.sum(new_df['MEDIA_FINAL']*new_df['CH_TOTAL'])
total_ch = np.sum(new_df['CH_TOTAL']) * 100
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)
return grade/total_ch
def pass_rate(dt):
new_dt = dt[dt['SITUACAO'].isin(Situation.SITATUION_PASS)]
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("")
......@@ -32,9 +32,9 @@ def load_dataframes(cwd='.'):
dataframe = fix_dataframes(dataframes)
dh = DataframeHolder(dataframe)
return dh
#~ dh.students.aggregate(teste)
# print(dh.students['MEDIA_FINAL'].aggregate(teste))
return dataframe
def read_excel(path, planilha='Planilha1'):
......@@ -96,4 +96,11 @@ def fix_admission(df):
def fix_evasion(df):
for evasion in EvasionForm.EVASION_FORM:
df.loc[df.FORMA_EVASAO.str.contains(evasion[1]).fillna(False), 'FORMA_EVASAO'] = evasion[0]
#~ df.loc[df.FORMA_EVASAO.str.contains(evasion[1]).fillna(1.0), 'FORMA_EVASAO'] = evasion[0]
df.loc[df.FORMA_EVASAO == evasion[1], 'FORMA_EVASAO'] = evasion[0]
#~ if(evasion[0] == 100):
#~ for x in df.FORMA_EVASAO.str.contains(evasion[1]).fillna(False):
#~ if(x != 0.0):
#~ print(x)
#~ print(df.FORMA_EVASAO.str.contains(evasion[1]).fillna(5))
#~ print(df[['MATR_ALUNO','FORMA_EVASAO']])
......@@ -6,8 +6,9 @@ import math
from datetime import timedelta
from pathlib import Path
from utils.utils import build_path
import analysis.degree_analysis as de_an
import analysis.student_analysis as st_an
from analysis.degree_analysis import *
from analysis.student_analysis import *
try:
to_unicode = unicode
except NameError:
......@@ -23,7 +24,7 @@ def build_cache(dataframe):
generate_student_data(path, dataframe)
# 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)
......@@ -36,19 +37,8 @@ def generate_degree_data(path, dataframe):
de_an.general_ira(dataframe)
pass
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)
def generate_student_data(path, dataframe):
# student_df = dataframe.groupby('MATR_ALUNO')
dataframe.students.aggregate(teste)
def generate_student_data(path,dataframe):
aluno_turmas(dataframe)
pass
def generate_student_list(path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment