Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adega
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Odair M.
adega
Commits
e1bbb12f
Commit
e1bbb12f
authored
7 years ago
by
Bruno Meyer
Browse files
Options
Downloads
Patches
Plain Diff
aluno_turmas
parent
4cc96469
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
script/analysis/student_analysis.py
+63
-0
63 additions, 0 deletions
script/analysis/student_analysis.py
script/base/dataframe_base.py
+1
-10
1 addition, 10 deletions
script/base/dataframe_base.py
script/build_cache.py
+4
-2
4 additions, 2 deletions
script/build_cache.py
with
68 additions
and
12 deletions
script/analysis/student_analysis.py
+
63
−
0
View file @
e1bbb12f
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("")
This diff is collapsed.
Click to expand it.
script/base/dataframe_base.py
+
1
−
10
View file @
e1bbb12f
...
...
@@ -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']])
This diff is collapsed.
Click to expand it.
script/build_cache.py
+
4
−
2
View file @
e1bbb12f
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment