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
4a615b20
Commit
4a615b20
authored
Aug 17, 2017
by
João Denis Rodrigues
Browse files
Merge historico e matricula + drop coluna nao utilizada
parent
5c2403e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
script/base/dataframe_base.py
View file @
4a615b20
...
...
@@ -33,6 +33,20 @@ def read_csv(path):
def
fix_dataframes
(
dataframes
):
for
df
in
dataframes
:
fix_situation
(
df
[
'dataframe'
])
fix_admission
(
df
[
'dataframe'
])
fix_evasion
(
df
[
'dataframe'
])
if
df
[
'name'
]
==
'historico.xls'
:
hist
=
df
[
'dataframe'
]
if
df
[
'name'
]
==
'matricula.xls'
:
mat
=
df
[
'dataframe'
]
merged
=
pd
.
merge
(
hist
,
mat
,
on
=
[
'MATR_ALUNO'
])
merged
.
drop
([
'ID_PESSOA'
,
'ID_CURRIC_ALUNO'
,
'CONCEITO'
,
'NOME_UNIDADE'
,
'ID_NOTA'
,
'ID_VERSAO_CURSO'
,
'NOME_PESSOA'
,
'SIGLA'
,
'NUM_VERSAO_y'
,
'COD_CURSO_y'
,
'DT_NASCIMENTO'
],
axis
=
1
,
inplace
=
True
)
merged
.
rename
(
columns
=
{
'NUM_VERSAO_x'
:
'NUM_VERSAO'
,
'COD_CURSO_x'
:
'COD_CURSO'
},
inplace
=
True
)
print
(
list
(
merged
))
def
fix_situation
(
df
):
if
hasattr
(
df
,
'SITUACAO'
):
...
...
@@ -41,3 +55,11 @@ def fix_situation(df):
if
situation
[
1
]
==
'Outro'
:
temp
=
df
[
~
df
[
'SITUACAO'
].
astype
(
str
).
str
.
isdigit
()]
df
.
loc
[
~
df
.
SITUACAO
.
astype
(
str
).
str
.
isdigit
()]
=
situation
[
0
]
def
fix_admission
(
df
):
pass
def
fix_evasion
(
df
):
pass
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