Commit 2581bf5a authored by Legton's avatar Legton
Browse files

arruma alguns bugs

parent 8951cd19
......@@ -36,29 +36,31 @@ def general_ira(df):
return (fixed.MEDIA_FINAL.mean(), fixed.MEDIA_FINAL.std())
def total_evasion_rate(df):
total_student = df['MATR_ALUNO'].shape[0]
total_evasion = df.loc[(df['FORMA_EVASAO']!=('Sem evasão')) & (df['FORMA_EVASAO']!=('Formatura')) & (df['FORMA_EVASAO']!=('Reintegração'))].shape[0]
students = df['MATR_ALUNO'].drop_duplicates()
total_student = students.shape[0]
total_evasion = students.loc[(df.FORMA_EVASAO != EvasionForm.EF_ATIVO) & (df.FORMA_EVASAO != EvasionForm.EF_FORMATURA) & (df.FORMA_EVASAO != EvasionForm.EF_REINTEGRACAO)].shape[0]
#voltando um aluno com evasao a mais do que deveria, devido a mudanca na tabela tem um ATIVO a menos
return total_evasion / total_student
def average_graduation_time(df):
graduates = df.loc[(df.FORMA_EVASAO == ('Formatura'))]
graduates = df.loc[(df.FORMA_EVASAO == EvasionForm.EF_FORMATURA)]
total_graduate = graduates.shape[0]
average_time = 0
for index, row in graduates.iterrows():
year_end = 2016
semester_end = 2
if pd.notnull(row['PERIODO_EVASAO']):
year_end = int(row['PERIODO_EVASAO'][:4])
if pd.notnull(row['ANO_EVASAO']):
year_end = int(row['ANO_EVASAO'])
try:
semester_end = int(row['PERIODO_EVASAO'][5])
semester_end = int(row['SEMESTRE_EVASAO'])
except ValueError:
semester_end = 2
year = int(row['PERIODO_INGRESSO'][:4])
semester = int(row['PERIODO_INGRESSO'][5])
year = int(row['ANO_INGRESSO'])
semester = int(row['SEMESTRE_INGRESSO'])
difference = 2 * (year_end - year) + (semester_end - semester) + 1
average_time += difference
average_time /= total_graduate
average_time /= 2
return average_time
\ No newline at end of file
......@@ -23,7 +23,7 @@ def build_cache(dataframe):
build_path(path)
generate_student_data(path, dataframe)
# generate_degree_data(path, dataframe)
generate_degree_data(path, dataframe)
generate_student_data(path,dataframe)
# generate_student_list(path)
# generate_admission_data(path)
......@@ -32,9 +32,11 @@ def build_cache(dataframe):
# generate_course_general_data(path)
def generate_degree_data(path, dataframe):
de_an.average_graduation(dataframe)
de_an.general_failure(dataframe)
de_an.general_ira(dataframe)
average_graduation(dataframe)
general_failure(dataframe)
general_ira(dataframe)
total_evasion_rate(dataframe)
average_graduation_time(dataframe)
pass
def generate_student_data(path,dataframe):
......
......@@ -3,13 +3,13 @@ import time
from base.dataframe_base import load_dataframes
from build_cache import build_cache
from datetime import timedelta
from analysis.degree_analysis import *
def main():
start_time = time.clock()
start_time_exec = time.time()
dataframe = load_dataframes(os.getcwd() + '/' + 'base')
build_cache(dataframe)
cpu_time = timedelta(seconds=round(time.clock() - start_time))
......
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