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
Harbor Registry
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
8951cd19
Commit
8951cd19
authored
7 years ago
by
Legton
Browse files
Options
Downloads
Plain Diff
fix merge conflicts
parents
7d018ce8
e1bbb12f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
script/analysis/student_analysis.py
+59
-14
59 additions, 14 deletions
script/analysis/student_analysis.py
script/base/dataframe_base.py
+11
-4
11 additions, 4 deletions
script/base/dataframe_base.py
script/build_cache.py
+6
-16
6 additions, 16 deletions
script/build_cache.py
with
76 additions
and
34 deletions
script/analysis/student_analysis.py
+
59
−
14
View file @
8951cd19
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("")
This diff is collapsed.
Click to expand it.
script/base/dataframe_base.py
+
11
−
4
View file @
8951cd19
...
...
@@ -32,9 +32,9 @@ def load_dataframes(cwd='.'):
dataframe
=
fix_dataframes
(
dataframes
)
dh
=
DataframeHolder
(
dataframe
)
return
d
h
#~ dh.students.aggregate(teste)
# print(dh.students['MEDIA_FINAL'].aggregate(teste))
return
d
ataframe
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']])
This diff is collapsed.
Click to expand it.
script/build_cache.py
+
6
−
16
View file @
8951cd19
...
...
@@ -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
):
...
...
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