Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Odair M.
adega
Commits
d5bcba9e
Commit
d5bcba9e
authored
Sep 06, 2017
by
João Denis Rodrigues
Browse files
Calculo ira medio alunos usando pandas
parent
ab12cc3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
script/base/dataframe_base.py
View file @
d5bcba9e
...
...
@@ -2,12 +2,28 @@ import re
import
os
import
sys
import
pandas
as
pd
import
numpy
as
np
from
glob
import
glob
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'
)
self
.
courses
=
dataframe
.
groupby
(
'COD_ATIV_CURRIC'
)
self
.
admission
=
dataframe
.
groupby
([
'ANO_INGRESSO'
,
'SEMESTRE_INGRESSO'
])
def
load_dataframes
(
cwd
=
'.'
):
dataframes
=
[]
for
path
,
dirs
,
files
in
os
.
walk
(
cwd
):
...
...
@@ -23,6 +39,9 @@ def load_dataframes(cwd='.'):
dataframes
.
append
(
dh
)
dataframe
=
fix_dataframes
(
dataframes
)
dh
=
DataframeHolder
(
dataframe
)
dh
.
students
.
aggregate
(
teste
)
# print(dh.students['MEDIA_FINAL'].aggregate(teste))
return
dataframe
...
...
script/build_cache.py
View file @
d5bcba9e
...
...
@@ -13,6 +13,7 @@ try:
except
NameError
:
to_unicode
=
str
def
build_cache
(
dataframe
):
# os.chdir("../src")
path
=
"cache"
...
...
@@ -20,13 +21,13 @@ def build_cache(dataframe):
path
+=
"/curso"
build_path
(
path
)
generate_degree_data
(
path
,
dataframe
)
generate_student_data
(
path
)
generate_student_list
(
path
)
generate_admission_data
(
path
)
generate_admission_list
(
path
)
generate_course_data
(
path
)
generate_course_general_data
(
path
)
#
generate_degree_data(path, dataframe)
#
generate_student_data(path)
#
generate_student_list(path)
#
generate_admission_data(path)
#
generate_admission_list(path)
#
generate_course_data(path)
#
generate_course_general_data(path)
def
generate_degree_data
(
path
,
dataframe
):
average_graduation
(
dataframe
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment